This repository was archived by the owner on Jan 30, 2026. It is now read-only.
chore: promote main to stable #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Package | |
| on: | |
| push: | |
| branches: [main, stable, "*.x"] | |
| paths: | |
| - "src/**" | |
| - "!**.md" | |
| - "package.json" | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| # - run: pnpm test | |
| - name: Release | |
| id: release | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| pnpm dlx semantic-release | |
| - name: Create sync PR to main | |
| if: github.ref == 'refs/heads/stable' | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| run: | | |
| pr_number=$(gh pr list --base main --head stable --state open --json number --jq '.[0].number') | |
| if [ -z "$pr_number" ]; then | |
| git fetch origin main | |
| if git diff --quiet origin/main...HEAD; then | |
| echo "Main is already up to date with stable; skipping PR." | |
| exit 0 | |
| fi | |
| pr_number=$(gh pr create --base main --head stable --title "chore: sync stable release to main" --body "Automated PR to merge the latest stable changes back into main." --json number --jq '.number') | |
| echo "Created PR #$pr_number to sync stable into main." | |
| else | |
| echo "PR #$pr_number already open to sync stable into main." | |
| fi | |
| gh pr merge "$pr_number" --merge --auto || echo "Auto-merge setup skipped (conditions not met)." |