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: Exit pre-release mode and clean up run: | echo "๐Ÿ”„ Ensuring we're not in pre-release mode for main branch..." # Exit pre-release mode if we're in it npx changeset pre exit || echo "Not in pre-release mode" # Remove pre.json file if it exists (belt and suspenders approach) if [ -f .changeset/pre.json ]; then echo "๐Ÿงน Removing pre.json file..." rm -f .changeset/pre.json fi # Verify the file is gone if [ ! -f .changeset/pre.json ]; then echo "โœ… pre.json successfully removed" else echo "โŒ Failed to remove pre.json" exit 1 fi - 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 }}