Release Packages #112
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 Packages | |
| on: | |
| workflow_run: | |
| workflows: ["Tests"] | |
| branches: [main] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| stable: | |
| description: 'Release stable version' | |
| required: false | |
| default: false | |
| type: boolean | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| jobs: | |
| release: | |
| if: | | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || | |
| github.event_name == 'workflow_dispatch' | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| name: release:${{ inputs.stable == true && 'stable' || 'snapshot' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # token: ${{ secrets.GITHUB_TOKEN }} | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Build | |
| run: bun run build | |
| - name: Setup npm registry | |
| run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> "$HOME/.npmrc" | |
| - name: Snapshot release | |
| if: inputs.stable != true | |
| run: | | |
| bun changeset version --snapshot next | |
| bun changeset publish --tag next --no-git-tag | |
| - name: Stable release | |
| if: inputs.stable == true | |
| run: | | |
| bun changeset version | |
| bun changeset publish --no-git-tag | |
| bun install | |
| - name: Commit changes | |
| if: inputs.stable == true | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git diff-index --quiet HEAD || git commit -m "chore: release [skip ci]" | |
| - name: Create git tags | |
| if: inputs.stable == true | |
| run: | | |
| bun changeset tag | |
| - name: Push changes | |
| if: inputs.stable == true | |
| run: | | |
| git push origin main | |
| git push origin main --tags |