1616 publish-binary :
1717 type : boolean
1818 default : false
19- description : Publish binary?
19+ description : Force publish binary?
2020 required : true
2121
2222env :
2626 # https://www.electronjs.org/docs/latest/tutorial/installation#cache
2727 electron_config_cache : ~/.cache/electron
2828 NODE_LIBCURL_GITHUB_TOKEN : ${{ secrets.NODE_LIBCURL_GITHUB_TOKEN }}
29- PUBLISH_BINARY : ${{ inputs.publish-binary }}
3029
3130concurrency :
3231 group : build-and-release-${{ github.ref_name }}
6665 run : pnpm build:dist
6766
6867 build-and-release :
68+ permissions :
69+ id-token : write
70+ attestations : write
71+ contents : write
72+ packages : write
6973 runs-on : ${{ matrix.os == 'alpine' && 'ubuntu-22.04' || matrix.os }}
7074 container : ${{ matrix.os == 'alpine' && format('node:{0}-alpine3.21', matrix.node) || '' }}
7175 needs :
@@ -78,26 +82,26 @@ jobs:
7882 electron-version :
7983 - ' '
8084 os :
81- # - macos-15
82- # - ubuntu-22.04
85+ - macos-15
86+ - ubuntu-22.04
8387 # - ubuntu-24.04-arm
8488 - alpine
85- # - windows-2025
89+ - windows-2025
8690 libcurl-release :
8791 - ${{ needs.set-params.outputs.latest-libcurl-release }}
8892 node :
8993 - 24
9094 - 22
91- # include:
92- # # electron builds
93- # - os: ubuntu-22.04
94- # libcurl-release: ${{ needs.set-params.outputs.latest-libcurl-release }}
95- # node: 24
96- # electron-version: 38.1.2
97- # - os: macos-15
98- # libcurl-release: ${{ needs.set-params.outputs.latest-libcurl-release }}
99- # node: 24
100- # electron-version: 38.1.2
95+ include :
96+ # electron builds
97+ - os : ubuntu-22.04
98+ libcurl-release : ${{ needs.set-params.outputs.latest-libcurl-release }}
99+ node : 24
100+ electron-version : 38.1.2
101+ - os : macos-15
102+ libcurl-release : ${{ needs.set-params.outputs.latest-libcurl-release }}
103+ node : 24
104+ electron-version : 38.1.2
101105 env :
102106 LIBCURL_RELEASE : ${{ matrix.libcurl-release }}
103107 LATEST_LIBCURL_RELEASE : ${{ matrix.libcurl-release }}
@@ -121,7 +125,14 @@ jobs:
121125
122126 - if : runner.os == 'Linux' && matrix.os != 'alpine'
123127 name : Install Needed packages on Linux
124- run : sudo apt-get install -y cmake groff
128+ run : sudo apt-get update && sudo apt-get install -y cmake groff
129+
130+ - name : Export Electron npm_config envs
131+ if : matrix.electron-version
132+ run : |
133+ echo "npm_config_runtime=electron" >> $GITHUB_ENV
134+ echo "npm_config_dist_url=https://electronjs.org/headers" >> $GITHUB_ENV
135+ echo "npm_config_target=${{ matrix.electron-version }}" >> $GITHUB_ENV
125136
126137 - name : Checkout
127138 uses : actions/checkout@v5
@@ -168,12 +179,14 @@ jobs:
168179 uses : mxschmitt/action-tmate@v3
169180 if : matrix.enable-debugging
170181
171- - name : ' Publish Binary'
182+ - name : ' Build and Package Binary'
172183 if : runner.os != 'Windows'
173- run : |
174- GIT_COMMIT=${{ github.sha }} \
175- GIT_REF_NAME=${{ github.ref_name}} \
176- ./scripts/ci/build.sh
184+ env :
185+ # this is false because we publish as a separate step
186+ PUBLISH_BINARY : false
187+ GIT_COMMIT : ${{ github.sha }}
188+ GIT_REF_NAME : ${{ github.ref_name }}
189+ run : ./scripts/ci/build.sh
177190
178191 - name : ' Check if fully installed and built'
179192 id : built-and-installed
@@ -192,15 +205,42 @@ jobs:
192205 path : |
193206 ~/.node-gyp
194207 ~/deps
195- key : v4-${{ runner .os }}-libcurl-deps-cache-${{ matrix.electron-version && 'electron' || 'node' }}-${{ matrix.electron-version || matrix.node }}
208+ key : v4-${{ matrix .os }}-libcurl-deps-cache-${{ matrix.electron-version && 'electron' || 'node' }}-${{ matrix.electron-version || matrix.node }}
196209
197- - name : ' Publish Binary Windows'
210+ - name : ' Build and Package Binary Windows'
198211 if : runner.os == 'Windows'
199212 shell : pwsh
213+ env :
214+ # this is false because we publish as a separate step
215+ PUBLISH_BINARY : false
216+ GIT_COMMIT : ${{ github.sha }}
217+ GIT_REF_NAME : ${{ github.ref_name }}
218+ run : ./scripts/ci/windows/build.ps1
219+
220+ - name : Create attestations
221+ uses : actions/attest-build-provenance@v3
222+ if : inputs.publish-binary
223+ with :
224+ subject-path : ' build/**/node_libcurl-*.tar.gz'
225+
226+ - name : ' Publish Binary [macos arm64]'
227+ if : runner.os == 'macOS' && inputs.publish-binary
228+ env :
229+ npm_config_target_arch : arm64
230+ run : |
231+ node scripts/module-packaging.js --publish "$(pnpm --silent pregyp reveal staged_tarball --silent)"
232+
233+ - name : ' Publish Binary [macos x64]'
234+ if : runner.os == 'macOS' && inputs.publish-binary
235+ env :
236+ npm_config_target_arch : x64
237+ run : |
238+ node scripts/module-packaging.js --publish "$(pnpm --silent pregyp reveal staged_tarball --silent)"
239+
240+ - name : ' Publish Binary [non macos]'
241+ if : runner.os != 'macOS' && inputs.publish-binary
200242 run : |
201- $env:GIT_COMMIT = '${{ github.sha }}'
202- $env:GIT_REF_NAME = '${{ github.ref_name }}'
203- ./scripts/ci/windows/build.ps1
243+ node scripts/module-packaging.js --publish "$(pnpm --silent pregyp reveal staged_tarball --silent)"
204244
205245 - name : Upload artifacts
206246 if : always() && runner.os != 'Windows'
0 commit comments