1
+ name : Test and build release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' v*'
7
+
8
+ jobs :
9
+ create-github-release :
10
+ name : Create Github Release
11
+ runs-on : ubuntu-20.04
12
+ outputs :
13
+ upload_url : ${{ steps.create-github-release.outputs.upload_url }}
14
+ steps :
15
+ - name : Checkout code
16
+ uses : actions/checkout@v2
17
+ - name : Create Github Release
18
+ id : create-github-release
19
+ uses : actions/create-release@v1
20
+ env :
21
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
22
+ with :
23
+ tag_name : ${{ github.ref }}
24
+ release_name : ${{ github.ref }}
25
+ draft : false
26
+ prerelease : false
27
+
28
+ build :
29
+ name : Test and build
30
+ runs-on : ubuntu-20.04
31
+ needs : create-github-release
32
+
33
+ steps :
34
+ - uses : actions/checkout@v2
35
+ - name : Use Node.js
36
+ uses : actions/setup-node@v1
37
+ with :
38
+ node-version : ' 15.x'
39
+ - name : Cache Node.js modules
40
+ uses : actions/cache@v2
41
+ with :
42
+ # npm cache files are stored in `~/.npm` on Linux/macOS
43
+ path : ~/.npm
44
+ key : ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
45
+ restore-keys : |
46
+ ${{ runner.OS }}-node-
47
+ ${{ runner.OS }}-
48
+ - name : Install dependencies
49
+ run : npm ci
50
+ - name : Lint, test and build release SDK
51
+ run : npm run ci
52
+ - name : Archive build artifacts
53
+ run : zip -r --junk-paths build.zip build/*
54
+ - name : Upload Release Asset (minified javascript)
55
+ uses : actions/upload-release-asset@v1
56
+ env :
57
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
+ with :
59
+ upload_url : ${{ needs.create-github-release.outputs.upload_url }}
60
+ asset_path : build/batch-webview-sdk.min.js
61
+ asset_name : batch-webview-sdk.min.js
62
+ asset_content_type : application/javascript
63
+ - name : Upload Release Asset (.zip)
64
+ uses : actions/upload-release-asset@v1
65
+ env :
66
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
+ with :
68
+ upload_url : ${{ needs.create-github-release.outputs.upload_url }}
69
+ asset_path : build.zip
70
+ asset_name : batch-webview-sdk-${{ github.ref }}.zip
71
+ asset_content_type : application/javascript
0 commit comments