Skip to content

Commit e92964e

Browse files
committed
ci(build-native): Implement release manifest publishing with integrity verification
- Add `merge-multiple: true` to `download-artifact` to flatten asset structure. - Split GitHub release process into binary upload and final publication steps. - Implement manifest generation using `gh` and `jq`. - Add strict SHA256 integrity verification using `sha256sum --check` before release finalization. - Add automated publishing of manifests to the `release-manifests` orphan branch. This ensures a secure, verifiable release pipeline where public manifests and tags are only updated after successful asset validation.
1 parent a76da93 commit e92964e

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

.github/workflows/build-native.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,36 @@ jobs:
273273
env:
274274
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
275275

276-
- name: Publish draft release
276+
- name: Generate Release Manifests
277+
id: generate_manifest
278+
env:
279+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280+
run: |
281+
mkdir -p dist
282+
283+
VERSION_TAG="${{ github.ref_name }}"
284+
BASE_TAG="${VERSION_TAG#@appland/}"
285+
TOOL_NAME="${BASE_TAG%%-v*}"
286+
287+
echo "Fetching release data for $VERSION_TAG..."
288+
gh release view "$VERSION_TAG" --json tagName,assets > release.json
289+
290+
echo "Generating manifest..."
291+
jq '{tag_name: .tagName, assets: [.assets[] | {name, url: .url, digest}]}' release.json > "dist/${BASE_TAG}.json"
292+
cp "dist/${BASE_TAG}.json" "dist/${TOOL_NAME}-latest.json"
293+
294+
echo "Verifying checksums..."
295+
jq -r '.assets[] | select(.digest != null) | .digest + " " + .name' release.json > checksums.txt
296+
297+
if grep -v '^sha256:' checksums.txt; then
298+
echo "::error::Invalid digest format found. Expected sha256:<hex>"
299+
exit 1
300+
fi
301+
302+
cd artifacts
303+
cut -c8- ../checksums.txt | sha256sum --check
304+
305+
- name: Publish GitHub Release
277306
run: gh release edit ${{ github.ref_name }} --draft=false
278307
env:
279308
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -282,3 +311,14 @@ jobs:
282311
run: yarn npm tag add `echo ${{ github.ref_name }} | sed -e s/-v/@/` latest
283312
env:
284313
YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
314+
315+
- name: Publish Manifests to release-manifests branch
316+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
317+
with:
318+
github_token: ${{ secrets.GITHUB_TOKEN }}
319+
publish_branch: release-manifests
320+
publish_dir: ./dist
321+
keep_files: true
322+
user_name: 'appland-release'
323+
user_email: 'release@app.land'
324+
commit_message: 'Update manifest for ${{ github.ref_name }}'

0 commit comments

Comments
 (0)