master
 1name: Release
 2
 3on:
 4  workflow_dispatch:
 5  workflow_run:
 6    workflows: [Test]
 7    branches: [master]
 8    types: [completed]
 9
10permissions:
11  contents: write
12
13concurrency: release
14
15jobs:
16  release:
17    runs-on: ubuntu-latest
18    if: ${{ github.event.workflow_run.conclusion == 'success' }}
19
20    steps:
21      - uses: actions/checkout@v4
22        with:
23          ref: master
24
25      - name: Use Node.js 22.x
26        uses: actions/setup-node@v4
27        with:
28          node-version: 22.x
29
30      - name: Configure git
31        run: |
32          git config user.name "${GITHUB_ACTOR}"
33          git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
34
35      - name: Bump version
36        run: |
37          npm version patch
38          git push
39
40      - name: Install dependencies
41        run: npm ci
42
43      - name: Build
44        run: npm run build
45
46      - name: Release
47        run: |
48          npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
49          npm publish
50        env:
51          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}