Skip to content

Commit 363c30d

Browse files
committed
ci: add preview tarball workflow for prerelease builds
1 parent 2091322 commit 363c30d

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Preview Tarball
2+
3+
on:
4+
push:
5+
branches: [main]
6+
# Manually trigger to pull in the latest CDK constructs changes
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: preview-tarball
14+
cancel-in-progress: true
15+
16+
jobs:
17+
preview-tarball:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v6
21+
- uses: actions/setup-node@v6
22+
with:
23+
node-version: '22.x'
24+
cache: 'npm'
25+
- uses: astral-sh/setup-uv@v7
26+
- run: npm run bundle
27+
- name: Get tarball info
28+
id: tarball
29+
run: |
30+
TARBALL_NAME=$(ls *.tgz | head -1 | xargs basename)
31+
echo "name=$TARBALL_NAME" >> $GITHUB_OUTPUT
32+
- name: Generate GitHub App Token
33+
id: app-token
34+
uses: actions/create-github-app-token@v1
35+
with:
36+
app-id: ${{ vars.APP_ID }}
37+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
38+
- name: Create or update prerelease
39+
env:
40+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
41+
TARBALL_NAME: ${{ steps.tarball.outputs.name }}
42+
run: |
43+
TAG="prerelease"
44+
45+
# Delete existing release if it exists (to update the tarball)
46+
gh release delete "$TAG" --yes --cleanup-tag 2>/dev/null || true
47+
48+
# Create a new pre-release with the tarball
49+
gh release create "$TAG" \
50+
"${TARBALL_NAME}" \
51+
--title "Preview (prerelease)" \
52+
--notes "Auto-generated tarball from the latest commit on main." \
53+
--prerelease \
54+
--target "${{ github.sha }}"

0 commit comments

Comments
 (0)