Skip to content

Commit 09d2fb4

Browse files
committed
Add GitHub release promotion and asset-consumption workflow
1 parent 75b2985 commit 09d2fb4

6 files changed

Lines changed: 161 additions & 1 deletion

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: publish-github-release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: Version to release (example 0.15.0)
8+
required: true
9+
build_real_run_id:
10+
description: Successful build-real workflow run ID
11+
required: true
12+
prerelease:
13+
description: Mark release as pre-release
14+
required: true
15+
default: "false"
16+
dry_run:
17+
description: Validate only, do not create GitHub release
18+
required: true
19+
default: "true"
20+
21+
permissions:
22+
contents: write
23+
actions: read
24+
25+
jobs:
26+
publish-release:
27+
runs-on: ubuntu-latest
28+
env:
29+
VERSION: ${{ inputs.version }}
30+
TAG: v${{ inputs.version }}
31+
BUNDLE_DIR: bundle
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Download release bundle artifact from build-real
36+
uses: actions/download-artifact@v4
37+
with:
38+
run-id: ${{ inputs.build_real_run_id }}
39+
github-token: ${{ github.token }}
40+
name: release-bundle-${{ inputs.version }}
41+
path: ${{ env.BUNDLE_DIR }}
42+
43+
- name: Validate bundle contents
44+
run: |
45+
test -f "${BUNDLE_DIR}/xsnap-worker-binaries-${VERSION}.tar.gz"
46+
test -f "${BUNDLE_DIR}/manifests/${VERSION}.json"
47+
48+
- name: Check release tag does not already exist
49+
run: |
50+
if gh release view "${TAG}" >/dev/null 2>&1; then
51+
echo "Release ${TAG} already exists" >&2
52+
exit 1
53+
fi
54+
55+
- name: Dry run summary
56+
if: ${{ inputs.dry_run == 'true' }}
57+
run: |
58+
echo "Dry run only. Would create release ${TAG} with assets:"
59+
echo "- ${BUNDLE_DIR}/xsnap-worker-binaries-${VERSION}.tar.gz"
60+
echo "- ${BUNDLE_DIR}/manifests/${VERSION}.json (renamed to xsnap-worker-manifest-${VERSION}.json)"
61+
62+
- name: Create GitHub release
63+
if: ${{ inputs.dry_run != 'true' }}
64+
run: |
65+
cp "${BUNDLE_DIR}/manifests/${VERSION}.json" "${BUNDLE_DIR}/xsnap-worker-manifest-${VERSION}.json"
66+
67+
prerelease_flag=""
68+
if [[ "${{ inputs.prerelease }}" == "true" ]]; then
69+
prerelease_flag="--prerelease"
70+
fi
71+
72+
cat > release-notes.txt <<NOTES
73+
Prebuilt xsnap-worker binaries for ${VERSION}.
74+
75+
Assets:
76+
- xsnap-worker-binaries-${VERSION}.tar.gz
77+
- xsnap-worker-manifest-${VERSION}.json
78+
NOTES
79+
80+
gh release create "${TAG}" \
81+
"${BUNDLE_DIR}/xsnap-worker-binaries-${VERSION}.tar.gz" \
82+
"${BUNDLE_DIR}/xsnap-worker-manifest-${VERSION}.json" \
83+
--title "xsnap-worker-binaries ${TAG}" \
84+
--notes-file release-notes.txt \
85+
${prerelease_flag}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,30 @@ The `build-real` workflow builds each supported target in a matrix, then assembl
5656
- `packages/<package>/` with staged `bin/` content
5757
- merged manifest `manifests/<version>.json`
5858
- `xsnap-worker-binaries-<version>.tar.gz`
59+
60+
## GitHub Release Promotion
61+
You can promote a successful `build-real` run to a GitHub Release without touching npm:
62+
63+
```bash
64+
gh workflow run publish-github-release \
65+
-f version=X.Y.Z \
66+
-f build_real_run_id=<build-real-run-id> \
67+
-f prerelease=true \
68+
-f dry_run=true
69+
```
70+
71+
Set `dry_run=false` to actually create tag `vX.Y.Z` and upload:
72+
- `xsnap-worker-binaries-X.Y.Z.tar.gz`
73+
- `xsnap-worker-manifest-X.Y.Z.json`
74+
75+
## agoric-sdk Pre-NPM Consumption
76+
`agoric-sdk` CI can consume these release assets directly:
77+
78+
```bash
79+
./scripts/download-release-assets.sh X.Y.Z /tmp/xsnap-assets
80+
tar -xzf /tmp/xsnap-assets/xsnap-worker-binaries-X.Y.Z.tar.gz -C /tmp/xsnap-assets
81+
target=\"$(./scripts/host-target.sh)\"
82+
export XSNAP_WORKER=\"/tmp/xsnap-assets/dist/${target}/release/xsnap-worker\"
83+
```
84+
85+
Then run agoric-sdk tests with `XSNAP_WORKER` override enabled.

RELEASE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
- `NPM_TOKEN` is configured in GitHub Actions secrets.
77
- Live publish is disabled unless `ALLOW_NPM_PUBLISH=true`.
88

9+
## GitHub Release (No NPM)
10+
Promote build artifacts to a GitHub release first:
11+
```bash
12+
gh workflow run publish-github-release \
13+
-f version=X.Y.Z \
14+
-f build_real_run_id=<build-real-run-id> \
15+
-f prerelease=true \
16+
-f dry_run=true
17+
```
18+
Set `dry_run=false` when ready to create the release.
19+
920
## Bundle Validation (No Publish)
1021
```bash
1122
gh workflow run release \

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"ci:check-npm": "./scripts/check-npm-availability.sh",
1515
"ci:check-version-sync": "./scripts/validate-version-sync.sh",
1616
"release:bundle:dry-run": "./scripts/publish-from-bundle.sh release/$VERSION --dry-run",
17-
"release:dry-run": "./scripts/publish-all.sh --dry-run"
17+
"release:dry-run": "./scripts/publish-all.sh --dry-run",
18+
"release:download-assets": "./scripts/download-release-assets.sh $VERSION ./release-assets"
1819
}
1920
}

scripts/download-release-assets.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
version="${1:-}"
5+
out_dir="${2:-}"
6+
repo="${3:-Agoric/xsnap-worker-binaries}"
7+
8+
if [[ -z "$version" || -z "$out_dir" ]]; then
9+
echo "Usage: $0 <version> <output-dir> [repo]" >&2
10+
echo "Example: $0 0.15.0 /tmp/xsnap-assets" >&2
11+
exit 1
12+
fi
13+
14+
mkdir -p "$out_dir"
15+
tag="v$version"
16+
17+
tarball="xsnap-worker-binaries-$version.tar.gz"
18+
manifest="xsnap-worker-manifest-$version.json"
19+
20+
gh release download "$tag" \
21+
--repo "$repo" \
22+
--pattern "$tarball" \
23+
--pattern "$manifest" \
24+
--dir "$out_dir"
25+
26+
echo "Downloaded release assets to $out_dir"
27+
echo "- $out_dir/$tarball"
28+
echo "- $out_dir/$manifest"

scripts/host-target.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
# shellcheck source=./common.sh
6+
source "$SCRIPT_DIR/common.sh"
7+
8+
host_target

0 commit comments

Comments
 (0)