Skip to content

Commit 4e74f83

Browse files
joe4devclaude
andcommitted
ci: add RC pre-release workflow for testing PRs against localstack-pro
Add a label-triggered workflow that builds the RIE binaries from an open PR and publishes them as a throwaway GitHub pre-release. This lets unmerged, high-risk lambda-runtime-init changes be tested against localstack-pro CI (via LAMBDA_INIT_RELEASE_VERSION=<rc-tag>) without merging or cutting a real release first. - Trigger: label a PR with "trigger:rc-release" - Builds both arch assets (aws-lambda-rie-x86_64/-arm64) via the existing compile-with-docker-all make target - Publishes a prerelease tagged v0.0.0-rc.pr<N>-<sha> and comments the tag + download URLs back on the PR - Auto-deletes the pre-release and tag when the PR is closed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 136f735 commit 4e74f83

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/rc-release.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: RC Release
2+
3+
# Builds the RIE binaries from an open PR and publishes them as a throwaway GitHub
4+
# pre-release, so the unmerged change can be tested against localstack-pro CI without
5+
# merging or cutting a real release. A developer consumes the resulting tag via
6+
# LAMBDA_INIT_RELEASE_VERSION=<rc-tag> when running localstack-pro CI.
7+
#
8+
# Trigger: add the label "trigger:rc-release" to a PR.
9+
# Cleanup: the pre-release + tag are deleted automatically when the PR is closed.
10+
11+
on:
12+
pull_request:
13+
types: [labeled, closed]
14+
15+
permissions:
16+
contents: write # create / delete the pre-release and its tag
17+
pull-requests: write # comment the resulting tag back on the PR
18+
19+
# Avoid concurrent RC builds for the same PR; a newer commit supersedes an in-flight build.
20+
concurrency:
21+
group: rc-release-pr-${{ github.event.pull_request.number }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
rc-release:
26+
if: github.event.action == 'labeled' && github.event.label.name == 'trigger:rc-release'
27+
runs-on: ubuntu-latest
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
PR_NUMBER: ${{ github.event.pull_request.number }}
31+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
32+
steps:
33+
- uses: actions/checkout@v6
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha }}
36+
37+
- name: Compute RC tag
38+
id: rc
39+
run: |
40+
short_sha="$(git rev-parse --short HEAD)"
41+
echo "tag=v0.0.0-rc.pr${PR_NUMBER}-${short_sha}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Unit tests
44+
run: make tests-with-docker
45+
46+
- name: Build binaries
47+
env:
48+
RELEASE_BUILD_LINKER_FLAGS: "-s -w"
49+
run: make compile-with-docker-all
50+
51+
- name: Publish RC pre-release
52+
uses: softprops/action-gh-release@v3
53+
with:
54+
tag_name: ${{ steps.rc.outputs.tag }}
55+
target_commitish: ${{ github.event.pull_request.head.sha }}
56+
name: "RC ${{ steps.rc.outputs.tag }} (PR #${{ github.event.pull_request.number }})"
57+
body: |
58+
Throwaway RC pre-release for testing PR #${{ github.event.pull_request.number }} against localstack-pro CI.
59+
Built from ${{ github.event.pull_request.head.sha }}. Auto-deleted when the PR is closed.
60+
Note: integ-tests are skipped in RC builds; localstack-pro CI is the real test.
61+
prerelease: true
62+
files: |
63+
bin/aws-lambda-rie-x86_64
64+
bin/aws-lambda-rie-arm64
65+
66+
- name: Comment RC tag on PR
67+
env:
68+
RC_TAG: ${{ steps.rc.outputs.tag }}
69+
run: |
70+
base_url="https://github.com/${GITHUB_REPOSITORY}/releases/download/${RC_TAG}"
71+
gh pr comment "$PR_NUMBER" --body "$(cat <<EOF
72+
🧪 **RC pre-release ready: \`${RC_TAG}\`**
73+
74+
Test this PR against localstack-pro CI by setting:
75+
\`\`\`
76+
LAMBDA_INIT_RELEASE_VERSION=${RC_TAG}
77+
\`\`\`
78+
79+
Assets:
80+
- ${base_url}/aws-lambda-rie-x86_64
81+
- ${base_url}/aws-lambda-rie-arm64
82+
83+
_Built from \`${HEAD_SHA}\`. integ-tests skipped in RC builds. This pre-release is auto-deleted when the PR is closed._
84+
EOF
85+
)"
86+
87+
cleanup:
88+
if: github.event.action == 'closed'
89+
runs-on: ubuntu-latest
90+
env:
91+
GH_TOKEN: ${{ github.token }}
92+
PR_NUMBER: ${{ github.event.pull_request.number }}
93+
steps:
94+
- name: Delete RC pre-releases for this PR
95+
run: |
96+
prefix="v0.0.0-rc.pr${PR_NUMBER}-"
97+
tags="$(gh release list --repo "$GITHUB_REPOSITORY" --limit 200 --json tagName --jq ".[].tagName | select(startswith(\"${prefix}\"))")"
98+
if [ -z "$tags" ]; then
99+
echo "No RC pre-releases found for PR #${PR_NUMBER}."
100+
exit 0
101+
fi
102+
echo "$tags" | while read -r tag; do
103+
echo "Deleting ${tag}"
104+
gh release delete "$tag" --repo "$GITHUB_REPOSITORY" --cleanup-tag --yes || true
105+
done

0 commit comments

Comments
 (0)