Release @backendworks/auth-db #3
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 @backendworks/auth-db | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: "Version bump type" | |
| required: true | |
| default: patch | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| release: | |
| name: Build, Version and Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://npm.pkg.github.com | |
| scope: "@backendworks" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Generate Prisma client | |
| run: npx prisma generate | |
| - name: Lint check | |
| run: npm run lint:check | |
| - name: Format check | |
| run: npm run format:check | |
| - name: Run tests | |
| run: npm test | |
| env: | |
| NODE_ENV: test | |
| - name: Build | |
| run: npm run build | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump version | |
| id: version | |
| run: | | |
| npm version ${{ inputs.bump }} --no-git-tag-version | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Commit and tag | |
| run: | | |
| git add package.json | |
| git commit -m "chore(release): @backendworks/auth-db@${{ steps.version.outputs.version }}" | |
| git tag "@backendworks/auth-db@${{ steps.version.outputs.version }}" | |
| git push origin HEAD --follow-tags | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to GitHub Packages | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "@backendworks/auth-db@${{ steps.version.outputs.version }}" | |
| name: "@backendworks/auth-db v${{ steps.version.outputs.version }}" | |
| generate_release_notes: true | |
| token: ${{ secrets.GITHUB_TOKEN }} |