Skip to content

Beta Release (manual retry) #59

Beta Release (manual retry)

Beta Release (manual retry) #59

Workflow file for this run

name: Beta Release
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [develop]
# Manual re-run for releases that failed mid-way: `[skip ci]` release commits
# never trigger the push event, and re-running a failed run pins the old SHA,
# so semantic-release refuses with "local branch is behind the remote one".
workflow_dispatch:
concurrency:
group: release-beta
cancel-in-progress: false
permissions:
actions: read
contents: write
issues: write
pull-requests: write
jobs:
release-beta:
# Automatic releases require a successful push-triggered CI run on develop.
# Manual retries are restricted to develop and verify that its current SHA passed CI below.
if: >-
(github.event_name == 'workflow_run' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'develop') ||
(github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/develop')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
- name: Verify successful CI for manual release
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ci_run_id="$(gh run list \
--workflow ci.yml \
--branch develop \
--commit "$GITHUB_SHA" \
--event push \
--status success \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId // empty')"
if [[ -z "$ci_run_id" ]]; then
echo "No successful CI run found for develop commit $GITHUB_SHA"
exit 1
fi
echo "Verified successful CI run: $ci_run_id"
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci --no-audit
- name: Build
run: npm run build
- name: Verify build output
run: |
if [[ ! -d "dist" ]]; then
echo "Build failed: dist directory not found"
exit 1
fi
echo "Build verification passed"
- name: Configure Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git fetch --all --tags
- name: Release Beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For a workflow_run event, GITHUB_REF is the ref of the workflow FILE (the repo's
# default branch, main) rather than the branch that triggered it (develop) — even
# though the checkout step above explicitly checks out develop's commit. semantic-
# release's env-ci detection reads only GITHUB_REF to pick the release branch, so
# left alone it decides it's releasing from main and tries to push there, which the
# branch protection rules reject. This job only ever runs for develop (see the `if:`
# above), so it's always correct to force it here.
GITHUB_REF: refs/heads/develop
GITHUB_REF_NAME: develop
run: npm run release