Release #336
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 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| actions: write | |
| jobs: | |
| beta: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Sync release tags into main | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if git rev-parse --verify origin/release >/dev/null 2>&1; then | |
| RELEASE_AHEAD=$(git rev-list --count HEAD..origin/release) | |
| if [ "$RELEASE_AHEAD" -gt 0 ]; then | |
| echo "Release branch is $RELEASE_AHEAD commits ahead of main, merging..." | |
| git merge origin/release --no-edit -X theirs || true | |
| git checkout origin/release -- CHANGELOG.md package.json package-lock.json 2>/dev/null || true | |
| git diff --quiet || git commit -am "chore: resolve merge conflicts from release" | |
| git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git main | |
| fi | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run semantic-release (beta) | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| promote: | |
| if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Merge main to release | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout release | |
| git merge main --no-edit -X theirs || true | |
| git checkout main -- CHANGELOG.md package.json package-lock.json 2>/dev/null || true | |
| git diff --quiet || git commit -am "chore: resolve merge conflicts from main" | |
| git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger stable release | |
| run: gh workflow run release.yml --ref release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| stable: | |
| if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run semantic-release (stable) | |
| run: npx semantic-release --branches release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Merge release back to main | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout main | |
| git merge release --no-edit -X theirs || true | |
| git checkout release -- CHANGELOG.md package.json package-lock.json 2>/dev/null || true | |
| git diff --quiet || git commit -am "chore: resolve merge conflicts from release" | |
| git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |