-
Notifications
You must be signed in to change notification settings - Fork 6
182 lines (154 loc) · 5.82 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
179
180
181
182
name: CI
on:
push:
branches: [main]
jobs:
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
# - name: Setup Node.js environment
# uses: actions/setup-node@v3
# with:
# node-version: lts/gallium
# cache: yarn
# - name: Install Node.js dependencies
# run: yarn install --frozen-lockfile
# - name: Lint
# if: false # TODO: Fix PyLint errors
# run: yarn lint
# - name: Run tests
# run: yarn test
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 35
strategy:
matrix:
include:
- os: Ubuntu (x86-64)
runs-on: ubuntu-latest
- os: macOS 13 (x86-64)
runs-on: macos-13
# GitHub currently only supports self-hosted runners for Apple Silicon Macs
- os: macOS 13 (ARM64)
runs-on: [self-hosted, macos-13, ARM64]
# - os: Windows (x86-64)
# runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Node.js environment
# setup-node stalls on self-hosted runner
if: ${{ !contains(matrix.runs-on, 'ARM64') }}
uses: actions/setup-node@v3
with:
node-version: lts/gallium
cache: yarn
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile --network-timeout 100000
# - name: Scan licenses
# uses: fossas/fossa-action@main # Use a specific version if locking is preferred
# with:
# api-key: ${{ secrets.FOSSA_API_KEY }}
- name: Prepare for macOS app notarization
if: startsWith(matrix.os, 'macos')
env:
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_KEY_ISSUER: ${{ secrets.APPLE_API_KEY_ISSUER }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: |
# Set temporary environment variables
KEYCHAIN_PROFILE="notarization"
KEYCHAIN_PASSWORD="$(openssl rand -base64 12)"
KEYCHAIN_PATH="$RUNNER_TEMP/code-signing.keychain-db"
CSC_PATH="$RUNNER_TEMP/build_certificate.p12"
APPLE_KEY_DIR_PATH="$HOME/private_keys"
APPLE_API_KEY_PATH="$APPLE_KEY_DIR_PATH/AuthKey_$APPLE_API_KEY_ID.p8"
# Create code signing Keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Write App Store Connect API key for Notary service
mkdir -p "$APPLE_KEY_DIR_PATH"
echo -n "$APPLE_API_KEY" > "$APPLE_API_KEY_PATH"
# Import Notary service credentials to Keychain
xcrun notarytool store-credentials \
-k="$APPLE_API_KEY_PATH" \
-d="$APPLE_API_KEY_ID" \
-i="$APPLE_API_KEY_ISSUER" \
--keychain="$KEYCHAIN_PATH" \
"$KEYCHAIN_PROFILE"
# Write code signing certificate
echo -n "$CSC_LINK" | base64 -d -o "$CSC_PATH"
# Import code signing certificate to Keychain
security import "$CSC_PATH" -P "$CSC_KEY_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH"
# Delete code signing certificate
rm -rf "$CSC_PATH"
# Set persistent environment variables
echo "KEYCHAIN_PROFILE=$KEYCHAIN_PROFILE" >> $GITHUB_ENV
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV
echo "APPLE_KEY_DIR_PATH=$APPLE_KEY_DIR_PATH" >> $GITHUB_ENV
- name: Build packages
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
yarn forcebuild
env:
APPLE_KEYCHAIN: ${{ env.KEYCHAIN_PATH }}
APPLE_KEYCHAIN_PROFILE: ${{ env.KEYCHAIN_PROFILE }}
CSC_LINK: ${{ startsWith(matrix.os, 'macos') && secrets.CSC_LINK || '' }}
CSC_KEY_PASSWORD: ${{ startsWith(matrix.os, 'macos') && secrets.CSC_KEY_PASSWORD || '' }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- name: Upload Recovery Utility ${{ matrix.os }} artifact
uses: actions/upload-artifact@v3
with:
name: Recovery Utility ${{ matrix.os }}
path: |
apps/recovery-utility/dist/*.AppImage
apps/recovery-utility/dist/*.exe
apps/recovery-utility/dist/*.zip
- name: Upload Recovery Relay artifact
uses: actions/upload-artifact@v3
with:
name: Recovery Relay
path: apps/recovery-relay/out/
- name: Clean up Apple Developer secrets
if: ${{ startsWith(matrix.os, 'macos') && always() }}
env:
KEYCHAIN_PATH: ${{ env.KEYCHAIN_PATH }}
APPLE_KEY_DIR_PATH: ${{ env.APPLE_KEY_DIR_PATH }}
run: |
security delete-keychain "$KEYCHAIN_PATH"
rm -rf "$APPLE_KEY_DIR_PATH"
pr:
name: Version packages
runs-on: ubuntu-latest
# needs: [test, build]
needs: [build]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: lts/gallium
cache: 'yarn'
- name: Install Dependencies
run: yarn
- name: Create release pull request
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ github.token }}