-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (59 loc) · 1.86 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build userscript
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout
- uses: actions/setup-node@v2
name: Setup Node.js environment
with:
node-version: '16.13.0'
cache: 'yarn'
- run: yarn install
name: Install dependencies
- uses: reviewdog/action-eslint@v1
name: Run ES Lint
if: ${{ github.event_name == 'pull_request' }}
- run: yarn build
name: Build userscript
- uses: actions/upload-artifact@v2
name: Save userscript as artifact
with:
name: userscript
path: dist/wm-toolkit.*.js
release:
name: Upload release assets
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
needs: build
steps:
- uses: actions/download-artifact@v2
name: Download userscript from artifact
with:
name: userscript
- uses: actions/upload-release-asset@v1
name: upload userscript to GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./wm-toolkit.user.js
asset_name: wm-toolkit.user.js
asset_content_type: application/javascript
- uses: actions/upload-release-asset@v1
name: upload userscript meta to GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./wm-toolkit.meta.js
asset_name: wm-toolkit.meta.js
asset_content_type: application/javascript