Skip to content

Commit 6f46405

Browse files
committed
chore(ci): Setup pipeline
1 parent fe76d85 commit 6f46405

File tree

4 files changed

+107
-3
lines changed

4 files changed

+107
-3
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

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": {

0 commit comments

Comments
 (0)