Skip to content

Commit 18b896b

Browse files
authored
Merge pull request #7 from BeyerleinDigital/tech/6-ci-pipeline
Setup CI pipeline
2 parents fe76d85 + 44360b2 commit 18b896b

File tree

6 files changed

+111
-14
lines changed

6 files changed

+111
-14
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
tags-ignore:
7+
- 'v*'
8+
pull_request:
9+
branches:
10+
- 'main'
11+
12+
jobs:
13+
build:
14+
name: Build
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [14.x, 15.x, 16.x, 17.x, 18.x]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: npm cache
27+
uses: actions/cache@v1
28+
with:
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-
33+
- run: npm ci
34+
- run: npm run build
35+
- run: npm run lint

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Create Release
7+
8+
jobs:
9+
build:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Use Node.js 16.x
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 16.x
19+
- name: npm cache
20+
uses: actions/cache@v1
21+
with:
22+
path: ~/.npm
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-
26+
- run: npm ci
27+
- run: npm run build
28+
- name: Package Release
29+
run: ./pack.sh
30+
- name: Get the version
31+
id: get_version
32+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
33+
- name: Create Release
34+
id: create_release
35+
uses: actions/create-release@v1
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
with:
39+
tag_name: ${{ github.ref }}
40+
release_name: Release ${{ github.ref }}
41+
body: Version ${{ steps.get_version.outputs.VERSION }}
42+
draft: false
43+
prerelease: false
44+
- name: Upload Release Asset .tar.gz
45+
id: upload_tar_asset
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
asset_path: ./release.tar.gz
52+
asset_name: ${{ format('esbuild-azure-functions-{0}.tar.gz', steps.get_version.outputs.VERSION) }}
53+
asset_content_type: application/gzip
54+
- name: Upload Release Asset .zip
55+
id: upload_zip_asset
56+
uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
asset_path: ./release.zip
62+
asset_name: ${{ format('esbuild-azure-functions-{0}.zip', steps.get_version.outputs.VERSION) }}
63+
asset_content_type: application/zip

nx.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3-
"npmScope": "nx-azure-functions-integration",
3+
"npmScope": "beyerlein",
44
"affected": {
55
"defaultBase": "main"
66
},
@@ -15,20 +15,13 @@
1515
"default": {
1616
"runner": "nx/tasks-runners/default",
1717
"options": {
18-
"cacheableOperations": [
19-
"build",
20-
"lint",
21-
"test",
22-
"e2e"
23-
]
18+
"cacheableOperations": ["build", "lint", "test", "e2e"]
2419
}
2520
}
2621
},
2722
"targetDefaults": {
2823
"build": {
29-
"dependsOn": [
30-
"^build"
31-
]
24+
"dependsOn": ["^build"]
3225
}
3326
},
3427
"workspaceLayout": {

pack.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
4+
cp LICENSE ./dist/packages/azure-functions
5+
6+
tar -zcf release.tar.gz dist/packages/azure-functions/
7+
zip -rq release.zip dist/packages/azure-functions/

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
"version": "0.0.0",
44
"license": "MIT",
55
"scripts": {
6-
"start": "nx serve",
7-
"build": "nx build",
8-
"test": "nx test"
6+
"build": "nx build azure-functions",
7+
"lint": "nx lint azure-functions"
98
},
109
"private": true,
1110
"devDependencies": {

packages/azure-functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@beyerleinf/nx-azure-functions",
2+
"name": "@beyerlein/nx-azure-functions",
33
"version": "0.0.1",
44
"main": "src/index.js",
55
"generators": "./generators.json",

0 commit comments

Comments
 (0)