Skip to content

Commit f79d18c

Browse files
authored
Bypass environment variables for license generation on Windows (#1377)
1 parent 5e377db commit f79d18c

File tree

4 files changed

+54
-11
lines changed

4 files changed

+54
-11
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
DO_NOT_TRACK: "1"
3939
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
4040
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
41+
ELECTRON_HEADERS_CACHE: ${{ github.workspace }}/.cache/electron-headers
4142
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/playwright
4243
TURBOREPO_CACHE: ${{ github.workspace }}/.turbo
4344

@@ -114,6 +115,13 @@ jobs:
114115
restore-keys: |
115116
${{ matrix.os }}-${{ matrix.arch }}-electron-builder-
116117
118+
- name: Use Electron headers cache
119+
id: electron-headers
120+
uses: actions/cache@v4
121+
with:
122+
path: ${{ env.ELECTRON_HEADERS_CACHE }}
123+
key: electron-headers-${{ env.electron_version }}
124+
117125
- name: Use Playwright cache
118126
id: playwright-cache
119127
uses: actions/cache@v4
@@ -159,6 +167,14 @@ jobs:
159167
if: runner.os == 'windows'
160168
run: echo "HOME=$HOME" | Out-File -FilePath $env:GITHUB_ENV -Append
161169

170+
- name: Install Electron headers
171+
if: steps.electron-headers.outputs.cache-hit != 'true'
172+
shell: bash
173+
run: |
174+
set -eo pipefail
175+
mkdir -p $ELECTRON_HEADERS_CACHE
176+
curl -sSfL https://www.electronjs.org/headers/v$electron_version/node-v$electron_version-headers.tar.gz -o $ELECTRON_HEADERS_CACHE/node-v$electron_version-headers.tar.gz
177+
162178
- name: Install Playwright with dependencies
163179
if: steps.playwright-cache.outputs.cache-hit != 'true'
164180
run: pnpx playwright install --with-deps
@@ -179,6 +195,8 @@ jobs:
179195

180196
- name: Rebuild native packages for Electron
181197
run: pnpm --color=always electron-rebuild -a ${{ matrix.arch }}
198+
env:
199+
npm_package_config_node_gyp_tarball: ${{ env.ELECTRON_HEADERS_CACHE }}/node-v${{ env.electron_version }}-headers.tar.gz
182200

183201
- name: Build extra resources
184202
id: build-resources
@@ -196,7 +214,7 @@ jobs:
196214
run: pnpm --color=always build:resources
197215

198216
- name: Build Electron app
199-
run: pnpm --color=always build:app:dir -- --${{ matrix.arch }}
217+
run: pnpm --color=always build:app:dir --${{ matrix.arch }}
200218

201219
- name: Run integration tests (Linux)
202220
id: integration-tests-linux

.github/workflows/release.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
DO_NOT_TRACK: "1"
2424
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
2525
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
26+
ELECTRON_HEADERS_CACHE: ${{ github.workspace }}/.cache/electron-headers
2627

2728
steps:
2829
- name: Checkout
@@ -152,6 +153,13 @@ jobs:
152153
restore-keys: |
153154
${{ matrix.os }}-${{ matrix.arch }}-electron-builder-
154155
156+
- name: Use Electron headers cache
157+
id: electron-headers
158+
uses: actions/cache@v4
159+
with:
160+
path: ${{ env.ELECTRON_HEADERS_CACHE }}
161+
key: electron-headers-${{ env.electron_version }}
162+
155163
- name: Install pnpm dependencies
156164
id: install-pnpm
157165
shell: bash
@@ -163,6 +171,14 @@ jobs:
163171
shell: bash
164172
run: pnpm install --color=always --prefer-offline --frozen-lockfile
165173

174+
- name: Install Electron headers
175+
if: steps.electron-headers.outputs.cache-hit != 'true'
176+
shell: bash
177+
run: |
178+
set -eo pipefail
179+
mkdir -p $ELECTRON_HEADERS_CACHE
180+
curl -sSfL https://www.electronjs.org/headers/v$electron_version/node-v$electron_version-headers.tar.gz -o $ELECTRON_HEADERS_CACHE/node-v$electron_version-headers.tar.gz
181+
166182
- name: Enable downloading for all architectures (macOS x64, Linux arm64, Windows arm64)
167183
if: runner.os == 'macOS' && matrix.arch == 'x64' || runner.os == 'Linux' && matrix.arch == 'arm64' || runner.os == 'Windows' && matrix.arch == 'arm64'
168184
shell: bash
@@ -183,6 +199,7 @@ jobs:
183199
env:
184200
npm_config_arch: ${{ matrix.arch }}
185201
npm_config_target_arch: ${{ matrix.arch }}
202+
npm_package_config_node_gyp_tarball: ${{ env.ELECTRON_HEADERS_CACHE }}/node-v${{ env.electron_version }}-headers.tar.gz
186203

187204
- name: Build extra resources
188205
id: build-resources
@@ -205,7 +222,7 @@ jobs:
205222
for var in APPLEID APPLEIDPASS APPLETEAMID CSC_LINK CSC_KEY_PASSWORD CSC_INSTALLER_LINK CSC_INSTALLER_KEY_PASSWORD; do
206223
test -n "${!var}" || unset $var
207224
done
208-
pnpm --color=always build:app -- \
225+
pnpm --color=always build:app \
209226
dmg pkg \
210227
--${{ matrix.arch }}
211228
env:
@@ -283,15 +300,15 @@ jobs:
283300
- name: Build Electron app (Linux)
284301
if: runner.os == 'Linux'
285302
run: |
286-
pnpm --color=always build:app -- \
303+
pnpm --color=always build:app \
287304
AppImage deb rpm \
288305
--${{ matrix.arch }}
289306
290307
- name: Build Electron app (Windows)
291308
if: runner.os == 'Windows'
292309
shell: bash
293310
run: |
294-
pnpm --color=always build:app -- \
311+
pnpm --color=always build:app \
295312
msi nsis \
296313
--${{ matrix.arch }}
297314

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
"biome:check": "corepack pnpm biome check",
1616
"biome:fix": "corepack pnpm biome check --fix",
1717
"biome:migrate": "corepack pnpm biome migrate --write",
18-
"build": "turbo run build",
19-
"build:app": "turbo run build:app",
20-
"build:app:dir": "corepack pnpm build:app -- dir",
18+
"build": "turbo run build --",
19+
"build:app": "turbo run build:app --",
20+
"build:app:dir": "corepack pnpm build:app dir",
2121
"build:core": "cd packages/core && corepack pnpm build",
22-
"build:dev": "NODE_ENV=development turbo run build:dev",
22+
"build:dev": "NODE_ENV=development turbo run build:dev --",
2323
"build:freelens": "cd freelens && corepack pnpm build",
24-
"build:resources": "turbo run build:resources",
24+
"build:resources": "turbo run build:resources --",
2525
"clean": "corepack pnpm -r clean",
2626
"clean:node_modules": "corepack pnpm -r clean:node_modules && corepack pnpm dlx [email protected] node_modules",
27-
"dev": "turbo run dev --parallel",
27+
"dev": "turbo run dev --parallel --",
2828
"electron-rebuild": "cd freelens && corepack pnpm electron-rebuild",
2929
"start": "cd freelens && corepack pnpm start",
3030
"start:os": "corepack pnpm dlx [email protected] --",

turbo.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
"CSC_LINK",
88
"CSC_KEY_PASSWORD",
99
"CSC_INSTALLER_LINK",
10-
"CSC_INSTALLER_KEY_PASSWORD"
10+
"CSC_INSTALLER_KEY_PASSWORD",
11+
"COREPACK_*",
12+
"LOCALAPPDATA",
13+
"DOWNLOAD_ALL_ARCHITECTURES",
14+
"NVM_*",
15+
"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",
16+
"PNPM_*",
17+
"npm_config_*",
18+
"npm_package_config_node_gyp_*"
1119
],
1220
"tasks": {
1321
"build": {

0 commit comments

Comments
 (0)