name: Release on: push: branches: - main concurrency: ${{ github.workflow }}-${{ github.ref }} permissions: contents: write pull-requests: write id-token: write jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'npm' - name: Cache node_modules uses: actions/cache@v4 with: path: | node_modules */*/node_modules key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Install Dependencies run: npm ci timeout-minutes: 2 - name: Check pre-release mode run: | set -euo pipefail echo "🔍 Checking pre-release mode status..." if [[ -f .changeset/pre.json ]]; then echo "❌ ERROR: Main branch is in pre-release mode!" echo "" echo "Pre-release mode should only be used on feature branches, not main." echo "" echo "To fix this, run the following commands locally:" echo " npx changeset pre exit" echo " git add -u" echo " git commit -m 'chore: exit pre-release mode'" echo " git push origin main" echo "" echo "Then re-run this workflow." exit 1 fi echo "✅ Not in pre-release mode - proceeding with release" - name: Create Release Pull Request or Publish to npm uses: changesets/action@v1 with: publish: ./.github/scripts/release.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}