-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.65 KB
/
release-build.yml
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
60
61
62
63
name: Build and Release
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y zip
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Read Release Info
id: read_release_info
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const yaml = require('js-yaml');
const releaseInfo = yaml.load(fs.readFileSync('RELEASE_INFO.yml', 'utf8'));
return releaseInfo;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.event_name == 'push'
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.read_release_info.outputs.tag_name }}
release_name: ${{ steps.read_release_info.outputs.release_name }}
body: ${{ steps.read_release_info.outputs.description }}
- name: Upload Release Asset
if: github.event_name == 'push'
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist.zip
asset_name: dist.zip
asset_content_type: application/zip