-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (127 loc) · 3.87 KB
/
release.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Package Windows Binaries
# This workflow will trigger on any tag/release created on *any* branch
# Make sure to create tags/releases only from the "master" branch for consistency
on:
release:
types: [published]
jobs:
test-app:
name: Lint and Test App
runs-on: ubuntu-latest
env:
EXCEL_FILE_URL: ${{ secrets.EXCEL_FILE_URL }}
SHEETJS_COLUMN: ${{ secrets.SHEETJS_COLUMN }}
SORT_ALPHABETICAL: ${{ secrets.SORT_ALPHABETICAL }}
SPECIAL_CHARACTERS: ${{ secrets.SPECIAL_CHARACTERS }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use NodeJS v16.14.2
uses: actions/setup-node@v3
with:
node-version: 16.14.2
- name: Install Dependencies
run: |
cd app
npm install
- name: Lint App
run: |
cd app
npm run lint
- name: Test App
run: |
cd app
npm test
build-on-win:
name: Build and Package App
runs-on: windows-latest
needs: test-app
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use NodeJS v16.14.2
uses: actions/setup-node@v3
with:
node-version: 16.14.2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('app/package-lock.json') }}
restore-keys: npm-
- name: Install Dependencies and lint
run: |
cd app
npm install
git rm .eslintrc.js
# Quick hack to fix unix to windows linebreak-style lint errors
git mv .eslintrc_win.js .eslintrc.js
npm run lint
- name: Packge and archive the executable files
run: |
cd app
cp .env.example .env
npm run build:win:all
cd dist
dir
- name: Archive Development Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: |
app/dist/ph-regions-win.exe
app/dist/ph-provinces-win.exe
retention-days: 1
release:
name: Release Built Binary
needs: build-on-win
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
- name: Prepare App
run: |
mv ph-provinces-win.exe ph-provinces-win_${{github.ref_name}}.exe
mv ph-regions-win.exe ph-regions-win_${{github.ref_name}}.exe
tar cvfz ph-regions-win_${{github.ref_name}}.tar.gz ph-regions-win_${{github.ref_name}}.exe
tar cvfz ph-provinces-win_${{github.ref_name}}.tar.gz ph-provinces-win_${{github.ref_name}}.exe
ls -l -a
- name: Attach Artifact to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
ph-regions-win_${{github.ref_name}}.tar.gz
ph-provinces-win_${{github.ref_name}}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish to NPM registry
runs-on: ubuntu-latest
needs: build-on-win
env:
IMAGE_URL: ${{ secrets.IMAGE_URL }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use NodeJS v16.14.2
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Publish package
run: |
chmod u+x scripts/npm-publish.sh
./scripts/npm-publish.sh
cd app
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}