-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (78 loc) · 3.18 KB
/
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
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
name: Build
# Run workflow for {action} on all branches, except the branches which the full build runs on
on:
push:
branches: [master, dev, ci]
tags:
- "v*.*.*" # Only watch for new v- Git tags
pull_request:
branches: [dev, ci]
# Set the default command-line across operating systems
# Fixes OS-specific $GITHUB_OUTPUT variable usage bug
# https://github.com/actions/cache/pull/954#issuecomment-1297079170
defaults:
run:
shell: bash
jobs:
release:
strategy:
matrix:
os: [macos-latest, windows-latest] # The operating systems to build for
node: [16]
runs-on: ${{ matrix.os }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # https://yarnpkg.com/features/release-workflow#commit-history
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3 # See: https://github.com/actions/setup-node
with:
node-version: ${{ matrix.node }}
# ----- Yarn Install and Caching ------
# Cache Yarn 3
# https://github.com/actions/cache/blob/main/examples.md#node---yarn-2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
${{ runner.os }}-node--yarn-
- name: Install dependencies
run: yarn install
# ----- End Yarn Install and Caching ------
# ----- Tests ------
- name: Run unit tests (/app)
working-directory: app
run: yarn run test
# ----- End Tests ------
# ----- electron-nuxt ------
- name: Build/release Electron app
uses: ./.github/actions/action-electron-builder
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
# type: string
github_token: ${{ secrets.github_token }}
# Set release to true only when a v- tag is pushed
# If the commit is tagged with a version (e.g. "v1.0.0")
# then create a Github release
# type: boolean
# See `github.ref`: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
# Mac certificate info
mac_certs: ${{ secrets.CSC_LINK }}
mac_certs_password: ${{ secrets.CSC_KEY_PASSWORD }}
env:
# macOS notarization
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
# Workaround for electron-builder error about existing file in CI
# https://github.com/electron-userland/electron-builder/issues/3179
USE_HARD_LINKS: false
# ----- / electron-nuxt ------