-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (169 loc) · 5.57 KB
/
ci.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Continuous Integration
on:
pull_request:
push:
branches: [master]
jobs:
static-checks:
runs-on: ubuntu-20.04
name: static-checks
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-root-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-root-
- run: npm ci
- run: npm run static-checks
ci:
name: ci-${{ matrix.os }}
needs: static-checks
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ matrix.os }}-monorepo-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-monorepo-
# TODO: Use `lerna bootstrap` (https://github.com/relaycorp/awala-gateway-desktop/issues/186)
- run: npm ci
- run: ../../node_modules/.bin/npm ci
working-directory: packages/daemon
- run: ../../node_modules/.bin/npm ci
working-directory: packages/ui
- run: npm test
- name: Build
shell: bash
run: .github/scripts/build.sh
- run: npm run dist
working-directory: packages/ui
release:
name: Release
needs: ci
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-root-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-root-
- name: Install dependencies
run: npm ci
- name: Create GitHub release
id: semantic-release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload new version number
continue-on-error: true
uses: actions/upload-artifact@v2
with:
name: new-version
path: version.txt
upload-package:
name: package-${{ matrix.os }}
needs: release
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: Awala*.AppImage
- os: windows-latest
artifact_name: Awala*.exe
- os: macos-latest
artifact_name: Awala*.dmg
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ matrix.os }}-monorepo-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-monorepo-
- name: Download new version number
id: version-artefact
continue-on-error: true
uses: actions/[email protected]
with:
name: new-version
- name: Load version
id: set-version
if: ${{ steps.version-artefact.outcome == 'success' }}
uses: juliangruber/read-file-action@v1
with:
path: ./version.txt
# TODO: Use `lerna bootstrap` (https://github.com/relaycorp/awala-gateway-desktop/issues/186)
- run: npm ci
if: ${{ steps.version-artefact.outcome == 'success' }}
- run: ../../node_modules/.bin/npm ci
if: ${{ steps.version-artefact.outcome == 'success' }}
working-directory: packages/daemon
- run: ../../node_modules/.bin/npm ci
if: ${{ steps.version-artefact.outcome == 'success' }}
working-directory: packages/ui
- name: Build
if: ${{ steps.version-artefact.outcome == 'success' }}
shell: bash
run: .github/scripts/build.sh
- name: Set version in app
if: ${{ steps.version-artefact.outcome == 'success' }}
run: npm version ${{ steps.set-version.outputs.content }}
working-directory: packages/ui/app
- run: npm run dist
if: ${{ steps.version-artefact.outcome == 'success' }}
working-directory: packages/ui
env:
WIN_CSC_LINK: ${{ secrets.WINDOWS_CODE_SIGNING_CERT }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_CODE_SIGNING_PASSWORD }}
- name: Upload installer to release
if: ${{ steps.version-artefact.outcome == 'success' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ steps.set-version.outputs.content }}
file: packages/ui/dist/${{ matrix.artifact_name }}
file_glob: true