release #12
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: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: 'Version bump type' | |
| required: true | |
| type: choice | |
| options: [patch, minor, major] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: generate app token | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 # required for changelog | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: setup node (for npm whoami + npm version) | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: verify npm token | |
| run: npm whoami | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: configure git identity | |
| run: | | |
| git config user.name "leviathan-cicd[bot]" | |
| git config user.email "leviathan-cicd[bot]@users.noreply.github.com" | |
| - name: bump version | |
| run: | | |
| npm version ${{ inputs.bump }} -m "chore(release): v%s" | |
| echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
| - name: push commit and tag | |
| run: | | |
| git push origin main | |
| git push origin v${{ env.VERSION }} |