diff options
author | Vijay A <avijayr@protonmail.com> | 2021-06-15 09:34:28 +0530 |
---|---|---|
committer | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-06-15 14:30:28 +0530 |
commit | 56fb881defdcdab0d87250ea982812dd7f621b74 (patch) | |
tree | 87ac24da9c450869e3468ddbcec05af1e6d5d8fe /.github | |
parent | Skip notarization of the build artifact if not building for the main repo (ie... (diff) | |
download | ferdium-app-56fb881defdcdab0d87250ea982812dd7f621b74.tar.gz ferdium-app-56fb881defdcdab0d87250ea982812dd7f621b74.tar.zst ferdium-app-56fb881defdcdab0d87250ea982812dd7f621b74.zip |
Added ability to run specific OS builds for manual trigger
This forced us to split the jobs into multiple copies (one per OS)
to avoid complex conditional logic in 'if' blocks.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/ferdi-builds.yml | 212 |
1 files changed, 183 insertions, 29 deletions
diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml index 74defe01e..bf6b6140f 100644 --- a/.github/workflows/ferdi-builds.yml +++ b/.github/workflows/ferdi-builds.yml | |||
@@ -31,7 +31,7 @@ env: | |||
31 | # DEBUG: electron-builder | 31 | # DEBUG: electron-builder |
32 | 32 | ||
33 | jobs: | 33 | jobs: |
34 | check_date: | 34 | check_updates: |
35 | runs-on: ubuntu-latest | 35 | runs-on: ubuntu-latest |
36 | name: Check latest commit | 36 | name: Check latest commit |
37 | outputs: | 37 | outputs: |
@@ -89,35 +89,19 @@ jobs: | |||
89 | git push origin nightly --no-verify | 89 | git push origin nightly --no-verify |
90 | fi | 90 | fi |
91 | 91 | ||
92 | build: | 92 | build_mac: |
93 | name: '${{ matrix.os }}' | 93 | name: 'macos ${{ github.event.inputs.message }}' |
94 | needs: check_date | 94 | needs: check_updates |
95 | if: ${{ needs.check_date.outputs.should_run != 'false' }} | 95 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'macOS')) }} |
96 | runs-on: ${{ matrix.os }} | 96 | runs-on: macos-10.15 |
97 | strategy: | ||
98 | matrix: | ||
99 | os: [macos-10.15, ubuntu-20.04, windows-2019] | ||
100 | node-version: [14.16.1] | ||
101 | fail-fast: false | ||
102 | steps: | 97 | steps: |
103 | - name: Set env vars for macOS and Linux | 98 | - name: Set env vars |
104 | if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux') | ||
105 | run: | | 99 | run: | |
106 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | 100 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV |
107 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | 101 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV |
108 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | 102 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV |
109 | echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 103 | echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV |
110 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 104 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
111 | - name: Set env vars for Windows | ||
112 | if: startsWith(runner.os, 'Windows') | ||
113 | run: | | ||
114 | echo "HOME=$USERPROFILE" >> $GITHUB_ENV | ||
115 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV | ||
116 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV | ||
117 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV | ||
118 | echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | ||
119 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | ||
120 | shell: bash | ||
121 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | 105 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch |
122 | uses: actions/checkout@v2 | 106 | uses: actions/checkout@v2 |
123 | if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} | 107 | if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} |
@@ -157,17 +141,15 @@ jobs: | |||
157 | with: | 141 | with: |
158 | key: ${{ runner.os }}-${{ env.cache-name }} | 142 | key: ${{ runner.os }}-${{ env.cache-name }} |
159 | path: ${{ env.ELECTRON_BUILDER_CACHE }} | 143 | path: ${{ env.ELECTRON_BUILDER_CACHE }} |
160 | - name: Use Node.js ${{ matrix.node-version }} | 144 | - name: Use Node.js 14.16.1 |
161 | uses: actions/setup-node@v2 | 145 | uses: actions/setup-node@v2 |
162 | with: | 146 | with: |
163 | node-version: ${{ matrix.node-version }} | 147 | node-version: 14.16.1 |
164 | - name: Upgrade Xcode version on the macOS 10.15 default runners provided by GH Actions | 148 | - name: Upgrade Xcode version on the macOS 10.15 default runners provided by GH Actions |
165 | if: startsWith(runner.os, 'macOS') | ||
166 | run: | | 149 | run: | |
167 | sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* | 150 | sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* |
168 | sudo xcode-select -s "/Applications/Xcode_12.4.app" | 151 | sudo xcode-select -s "/Applications/Xcode_12.4.app" |
169 | - name: Uninstall locally and reinstall node-gyp globally | 152 | - name: Uninstall locally and reinstall node-gyp globally |
170 | if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux') | ||
171 | run: | | 153 | run: | |
172 | npm uninstall node-gyp | 154 | npm uninstall node-gyp |
173 | npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" | 155 | npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" |
@@ -194,8 +176,6 @@ jobs: | |||
194 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} | 176 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} |
195 | # CSC_LINK: ${{ secrets.CSC_LINK }} | 177 | # CSC_LINK: ${{ secrets.CSC_LINK }} |
196 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | 178 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} |
197 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | ||
198 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | ||
199 | - name: Build Ferdi with publish for 'release' branch | 179 | - name: Build Ferdi with publish for 'release' branch |
200 | if: ${{ env.GIT_BRANCH_NAME == 'release' }} | 180 | if: ${{ env.GIT_BRANCH_NAME == 'release' }} |
201 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi | 181 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi |
@@ -208,5 +188,179 @@ jobs: | |||
208 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} | 188 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} |
209 | # CSC_LINK: ${{ secrets.CSC_LINK }} | 189 | # CSC_LINK: ${{ secrets.CSC_LINK }} |
210 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | 190 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} |
191 | |||
192 | build_linux: | ||
193 | name: 'ubuntu ${{ github.event.inputs.message }}' | ||
194 | needs: check_updates | ||
195 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'Linux')) }} | ||
196 | runs-on: ubuntu-20.04 | ||
197 | steps: | ||
198 | - name: Set env vars | ||
199 | run: | | ||
200 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | ||
201 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | ||
202 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | ||
203 | echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | ||
204 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | ||
205 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | ||
206 | uses: actions/checkout@v2 | ||
207 | if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} | ||
208 | with: | ||
209 | submodules: recursive | ||
210 | ref: nightly | ||
211 | - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch | ||
212 | uses: actions/checkout@v2 | ||
213 | if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }} | ||
214 | with: | ||
215 | submodules: recursive | ||
216 | - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off) | ||
217 | run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
218 | shell: bash | ||
219 | - name: Cache node modules | ||
220 | uses: actions/cache@v2 | ||
221 | env: | ||
222 | cache-name: cache-node-modules | ||
223 | with: | ||
224 | path: ${{ env.NPM_CACHE }} | ||
225 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
226 | restore-keys: | | ||
227 | ${{ runner.os }}-build-${{ env.cache-name }}- | ||
228 | ${{ runner.os }}-build- | ||
229 | ${{ runner.os }}- | ||
230 | - name: Cache electron modules | ||
231 | uses: actions/cache@v2 | ||
232 | env: | ||
233 | cache-name: cache-electron-modules | ||
234 | with: | ||
235 | key: ${{ runner.os }}-${{ env.cache-name }} | ||
236 | path: ${{ env.ELECTRON_CACHE }} | ||
237 | - name: Cache electron-builder modules | ||
238 | uses: actions/cache@v2 | ||
239 | env: | ||
240 | cache-name: cache-electron-builder-modules | ||
241 | with: | ||
242 | key: ${{ runner.os }}-${{ env.cache-name }} | ||
243 | path: ${{ env.ELECTRON_BUILDER_CACHE }} | ||
244 | - name: Use Node.js 14.16.1 | ||
245 | uses: actions/setup-node@v2 | ||
246 | with: | ||
247 | node-version: 14.16.1 | ||
248 | - name: Uninstall locally and reinstall node-gyp globally | ||
249 | run: | | ||
250 | npm uninstall node-gyp | ||
251 | npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" | ||
252 | - name: Install node dependencies recursively | ||
253 | run: npx lerna bootstrap | ||
254 | - name: Package recipes | ||
255 | run: npm i && npm run package | ||
256 | working-directory: ./recipes | ||
257 | - name: Run linter and tests | ||
258 | run: npm run lint && npm run test | ||
259 | - name: Build Ferdi without publish for any branch not 'nightly' and not 'release' | ||
260 | if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }} | ||
261 | run: npm run build -- --publish never | ||
262 | shell: bash | ||
263 | - name: Build Ferdi with publish for 'nightly' branch | ||
264 | if: ${{ env.GIT_BRANCH_NAME == 'nightly' }} | ||
265 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies | ||
266 | shell: bash | ||
267 | env: | ||
268 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | ||
269 | CSC_IDENTITY_AUTO_DISCOVERY: false | ||
270 | - name: Build Ferdi with publish for 'release' branch | ||
271 | if: ${{ env.GIT_BRANCH_NAME == 'release' }} | ||
272 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi | ||
273 | shell: bash | ||
274 | env: | ||
275 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | ||
276 | CSC_IDENTITY_AUTO_DISCOVERY: false | ||
277 | |||
278 | build_windows: | ||
279 | name: 'windows ${{ github.event.inputs.message }}' | ||
280 | needs: check_updates | ||
281 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'Windows')) }} | ||
282 | runs-on: windows-2019 | ||
283 | steps: | ||
284 | - name: Set env vars | ||
285 | run: | | ||
286 | echo "HOME=$USERPROFILE" >> $GITHUB_ENV | ||
287 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV | ||
288 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV | ||
289 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV | ||
290 | echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | ||
291 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | ||
292 | shell: bash | ||
293 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | ||
294 | uses: actions/checkout@v2 | ||
295 | if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} | ||
296 | with: | ||
297 | submodules: recursive | ||
298 | ref: nightly | ||
299 | - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch | ||
300 | uses: actions/checkout@v2 | ||
301 | if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }} | ||
302 | with: | ||
303 | submodules: recursive | ||
304 | - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off) | ||
305 | run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
306 | shell: bash | ||
307 | - name: Cache node modules | ||
308 | uses: actions/cache@v2 | ||
309 | env: | ||
310 | cache-name: cache-node-modules | ||
311 | with: | ||
312 | path: ${{ env.NPM_CACHE }} | ||
313 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
314 | restore-keys: | | ||
315 | ${{ runner.os }}-build-${{ env.cache-name }}- | ||
316 | ${{ runner.os }}-build- | ||
317 | ${{ runner.os }}- | ||
318 | - name: Cache electron modules | ||
319 | uses: actions/cache@v2 | ||
320 | env: | ||
321 | cache-name: cache-electron-modules | ||
322 | with: | ||
323 | key: ${{ runner.os }}-${{ env.cache-name }} | ||
324 | path: ${{ env.ELECTRON_CACHE }} | ||
325 | - name: Cache electron-builder modules | ||
326 | uses: actions/cache@v2 | ||
327 | env: | ||
328 | cache-name: cache-electron-builder-modules | ||
329 | with: | ||
330 | key: ${{ runner.os }}-${{ env.cache-name }} | ||
331 | path: ${{ env.ELECTRON_BUILDER_CACHE }} | ||
332 | - name: Use Node.js 14.16.1 | ||
333 | uses: actions/setup-node@v2 | ||
334 | with: | ||
335 | node-version: 14.16.1 | ||
336 | - name: Install node dependencies recursively | ||
337 | run: npx lerna bootstrap | ||
338 | - name: Package recipes | ||
339 | run: npm i && npm run package | ||
340 | working-directory: ./recipes | ||
341 | - name: Run linter and tests | ||
342 | run: npm run lint && npm run test | ||
343 | - name: Build Ferdi without publish for any branch not 'nightly' and not 'release' | ||
344 | if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }} | ||
345 | run: npm run build -- --publish never | ||
346 | shell: bash | ||
347 | - name: Build Ferdi with publish for 'nightly' branch | ||
348 | if: ${{ env.GIT_BRANCH_NAME == 'nightly' }} | ||
349 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies | ||
350 | shell: bash | ||
351 | env: | ||
352 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | ||
353 | CSC_IDENTITY_AUTO_DISCOVERY: false | ||
354 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) | ||
355 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | ||
356 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | ||
357 | - name: Build Ferdi with publish for 'release' branch | ||
358 | if: ${{ env.GIT_BRANCH_NAME == 'release' }} | ||
359 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi | ||
360 | shell: bash | ||
361 | env: | ||
362 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | ||
363 | CSC_IDENTITY_AUTO_DISCOVERY: false | ||
364 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) | ||
211 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | 365 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} |
212 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | 366 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} |