|
| 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 | + |
| 51 | + |
| 52 | + - name: Install wasm-pack |
| 53 | + |
| 54 | + with: |
| 55 | + version: 'latest' |
| 56 | + |
| 57 | + - name: Setup Node |
| 58 | + uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + node-version: '22.18.0' |
| 61 | + registry-url: 'https://registry.npmjs.org' |
| 62 | + |
| 63 | + - name: Install project dependencies |
| 64 | + run: bun install --frozen-lockfile |
| 65 | + |
| 66 | + - name: Apply snapshot versions |
| 67 | + run: bunx changeset version --snapshot beta |
| 68 | + |
| 69 | + - name: Build workspace |
| 70 | + env: |
| 71 | + NX_DAEMON: 'false' |
| 72 | + run: bun run build |
| 73 | + |
| 74 | + - name: Publish prerelease packages |
| 75 | + env: |
| 76 | + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} |
| 77 | + run: bunx changeset publish --tag beta |
| 78 | + |
| 79 | + - name: Reset working tree |
| 80 | + if: always() |
| 81 | + run: | |
| 82 | + git reset --hard HEAD |
| 83 | + git clean -fd |
0 commit comments