Skip to content

Commit 9324970

Browse files
committed
chore: add GitHub Actions workflow for prerelease snapshot
1 parent ab4811a commit 9324970

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/prerelease.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Prerelease Snapshot
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
publish:
12+
name: Publish prerelease snapshot
13+
runs-on: ubuntu-latest
14+
env:
15+
RELEASE_BRANCH_PREFIX: 'changeset-release/'
16+
steps:
17+
- name: Ensure Changesets release branch
18+
run: |
19+
if [[ "${GITHUB_REF_NAME}" != ${RELEASE_BRANCH_PREFIX}* ]]; then
20+
echo "❌ This workflow must be triggered on a Changesets release branch. Current branch: ${GITHUB_REF_NAME}"
21+
echo "👉 From the release PR, choose \"Run workflow\" and keep the default branch (changeset-release/...)."
22+
exit 1
23+
fi
24+
25+
- name: Check NPM Token
26+
run: |
27+
if [ -z "${{ secrets.NODE_AUTH_TOKEN }}" ]; then
28+
echo "❌ NODE_AUTH_TOKEN secret is not set. Please add it to repository secrets."
29+
exit 1
30+
else
31+
echo "✅ NODE_AUTH_TOKEN secret is available."
32+
fi
33+
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Configure git user
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
44+
- name: Setup Bun
45+
uses: oven-sh/setup-bun@v1
46+
with:
47+
bun-version: latest
48+
49+
- name: Install rust
50+
uses: actions-rs/toolchain@v1
51+
with:
52+
toolchain: stable
53+
override: true
54+
components: rust-std
55+
56+
- name: Install wasm-pack
57+
uses: jetli/[email protected]
58+
with:
59+
version: 'latest'
60+
61+
- name: Setup Node
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: '22.18.0'
65+
registry-url: 'https://registry.npmjs.org'
66+
67+
- name: Install project dependencies
68+
run: bun install --frozen-lockfile
69+
70+
- name: Apply snapshot versions
71+
run: bunx changeset version --snapshot beta
72+
73+
- name: Build workspace
74+
run: bun run build
75+
76+
- name: Publish prerelease packages
77+
env:
78+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
79+
run: bunx changeset publish --tag beta
80+
81+
- name: Reset working tree
82+
if: always()
83+
run: |
84+
git reset --hard HEAD
85+
git clean -fd

0 commit comments

Comments
 (0)