Publish #218
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: Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'The npm tag to publish to' | |
| required: true | |
| type: choice | |
| options: | |
| - latest | |
| - test | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| environment: Release | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: true # needed for git push | |
| - uses: ./.github/actions/setup-deps | |
| - run: pnpm build:packages | |
| - name: git config | |
| run: | | |
| git config --global user.name 'Thinkmill Release Bot' | |
| git config --global user.email '[email protected]' | |
| - name: version packages | |
| if: inputs.tag != 'latest' | |
| run: | | |
| pnpm changeset version --snapshot ${{ inputs.tag }} | |
| git commit -a -m 'rc' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: npm publish, git tag | |
| run: pnpm changeset publish --tag ${{ inputs.tag }} | |
| # reset, then we have a tagged dangling commit | |
| - name: git push | |
| if: inputs.tag != 'latest' | |
| run: | | |
| git reset HEAD~1 --hard | |
| - run: git push origin --tags |