@@ -13,7 +13,6 @@ concurrency:
1313
1414permissions :
1515 contents : read
16- packages : write
1716
1817env :
1918 SENTRY_CLIENT_ID : ${{ vars.SENTRY_CLIENT_ID }}
2221 NODE_VERSION_24 : " 24.18.0"
2322
2423jobs :
24+ nightly-version :
25+ name : Compute nightly version
26+ runs-on : ubuntu-latest
27+ outputs :
28+ version : ${{ steps.version.outputs.version }}
29+ steps :
30+ - uses : actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
31+ - name : Compute version from the commit timestamp
32+ id : version
33+ run : node scripts/cli-nightly-version.mjs
34+
2535 build-binary :
2636 name : Build Binary (${{ matrix.target }})
37+ needs : nightly-version
2738 runs-on : ${{ matrix.os }}
2839 environment : ${{ github.ref == 'refs/heads/main' && 'production' || startsWith(github.ref, 'refs/heads/release/cli/') && 'cli-release' || '' }}
2940 strategy :
4960 cache : pnpm
5061 - name : Install dependencies
5162 run : pnpm install --frozen-lockfile
63+ - name : Stamp the nightly binary version
64+ if : github.ref == 'refs/heads/main'
65+ env :
66+ NIGHTLY_VERSION : ${{ needs.nightly-version.outputs.version }}
67+ shell : bash
68+ run : |
69+ jq --arg version "$NIGHTLY_VERSION" '.version = $version' packages/cli/package.json > "$RUNNER_TEMP/cli-package.json"
70+ mv "$RUNNER_TEMP/cli-package.json" packages/cli/package.json
5271 - name : Setup codesign dependencies
5372 env :
5473 APPLE_CERT_DATA : ${{ secrets.APPLE_CERT_DATA }}
@@ -105,8 +124,12 @@ jobs:
105124 SENTRY_AUTH_TOKEN : " "
106125 SENTRY_TOKEN : " "
107126 SENTRY_CONFIG_DIR : ${{ runner.temp }}/.sentry-smoke
127+ NIGHTLY_VERSION : ${{ needs.nightly-version.outputs.version }}
108128 run : |
109129 packages/cli/dist-bin/sentry-linux-x64 --help
130+ if [[ "$GITHUB_REF" == 'refs/heads/main' ]]; then
131+ test "$(packages/cli/dist-bin/sentry-linux-x64 --version)" = "$NIGHTLY_VERSION"
132+ fi
110133 output=$(packages/cli/dist-bin/sentry-linux-x64 auth status 2>&1) && status=$? || status=$?
111134 test "$status" -eq 10
112135 printf '%s\n' "$output" | grep -qi 'not authenticated'
@@ -123,6 +146,106 @@ jobs:
123146 name : sentry-${{ matrix.target }}-gz
124147 path : packages/cli/dist-bin/*.gz
125148
149+ generate-patches :
150+ name : Generate nightly delta patches
151+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
152+ needs : [nightly-version, build-binary]
153+ runs-on : ubuntu-latest
154+ continue-on-error : true
155+ permissions :
156+ contents : read
157+ packages : read
158+ outputs :
159+ from-version : ${{ steps.generate.outputs.from-version }}
160+ steps :
161+ - name : Download binaries and compressed artifacts
162+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
163+ with :
164+ pattern : sentry-*-*
165+ path : new-binaries
166+ merge-multiple : true
167+ - name : Generate patches against the preceding Toolkit nightly
168+ id : generate
169+ uses : BYK/binpatch/action@9ba6bbb8227fcbd2521852d2311c82afac5e9573 # 0.4.2
170+ with :
171+ mode : generate-ghcr
172+ version : ${{ needs.nightly-version.outputs.version }}
173+ registry : ghcr.io
174+ repo : getsentry/toolkit
175+ binary-glob : ' sentry-*'
176+ new-binaries-dir : new-binaries
177+ new-gz-dir : new-binaries
178+ patches-dir : patches
179+ - name : Upload patches
180+ if : steps.generate.outputs.has-patches == 'true'
181+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
182+ with :
183+ name : sentry-patches
184+ path : patches/*.patch
185+
186+ publish-nightly :
187+ name : Publish Toolkit nightly to GHCR
188+ if : >-
189+ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' &&
190+ needs.nightly-version.result == 'success' && needs.build-binary.result == 'success' &&
191+ (needs.generate-patches.result == 'success' || needs.generate-patches.result == 'failure')
192+ needs : [nightly-version, build-binary, generate-patches]
193+ runs-on : ubuntu-latest
194+ permissions :
195+ contents : read
196+ packages : write
197+ steps :
198+ - name : Download compressed binaries
199+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
200+ with :
201+ pattern : sentry-*-gz
202+ path : artifacts
203+ merge-multiple : true
204+ - name : Download binaries for patch integrity annotations
205+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
206+ with :
207+ pattern : sentry-*-*
208+ path : binaries
209+ merge-multiple : true
210+ - name : Download optional delta patches
211+ id : patches
212+ continue-on-error : true
213+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
214+ with :
215+ name : sentry-patches
216+ path : patches
217+ - name : Publish rolling and versioned manifests
218+ uses : BYK/binpatch/action@9ba6bbb8227fcbd2521852d2311c82afac5e9573 # 0.4.2
219+ with :
220+ mode : publish-ghcr
221+ version : ${{ needs.nightly-version.outputs.version }}
222+ registry : ghcr.io
223+ repo : getsentry/toolkit
224+ binary-glob : ' sentry-*'
225+ artifacts-dir : artifacts
226+ binaries-dir : binaries
227+ patches-dir : patches
228+ from-version : ${{ needs.generate-patches.outputs.from-version }}
229+ - name : Verify public nightly and immutable version tag
230+ env :
231+ NIGHTLY_VERSION : ${{ needs.nightly-version.outputs.version }}
232+ shell : bash
233+ run : |
234+ set -euo pipefail
235+ token=$(curl -fsS 'https://ghcr.io/token?scope=repository:getsentry/toolkit:pull' | jq -er '.token')
236+ for tag in nightly "nightly-${NIGHTLY_VERSION}"; do
237+ manifest=$(curl -fsS \
238+ -H "Authorization: Bearer ${token}" \
239+ -H 'Accept: application/vnd.oci.image.manifest.v1+json' \
240+ "https://ghcr.io/v2/getsentry/toolkit/manifests/${tag}")
241+ jq -e --arg version "$NIGHTLY_VERSION" '
242+ .annotations.version == $version and
243+ .annotations["org.opencontainers.image.source"] == "https://github.com/getsentry/toolkit" and
244+ ([.layers[].annotations["org.opencontainers.image.title"]] | sort) ==
245+ (["sentry-darwin-arm64.gz", "sentry-darwin-x64.gz", "sentry-linux-arm64.gz", "sentry-linux-x64.gz", "sentry-windows-x64.exe.gz"] | sort)
246+ ' <<< "$manifest" > /dev/null
247+ done
248+
126249 build-npm :
127250 name : Build npm Package
128251 runs-on : ubuntu-latest
0 commit comments