Release #18
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: | |
| title: | |
| description: "Release title (blank for tag)" | |
| required: false | |
| bump: | |
| description: "Bump type (major/minor/patch/auto)" | |
| default: "auto" | |
| required: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| name: Release package | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| - name: Install node 18 | |
| uses: actions/setup-node@v6.2.0 | |
| with: | |
| node-version: "18" | |
| cache: npm | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Setup SSH signing | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SIGNING_KEY }}" > ~/.ssh/signing_key | |
| chmod 600 ~/.ssh/signing_key | |
| git config gpg.format ssh | |
| git config user.signingkey ~/.ssh/signing_key | |
| git config commit.gpgsign true | |
| - name: Determine next SemVer | |
| id: bumper | |
| uses: tomerfi/version-bumper-action@2.0.5 | |
| with: | |
| bump: '${{ github.event.inputs.bump }}' | |
| - name: Update package with new version | |
| run: npm version ${{ steps.bumper.outputs.next }} --no-git-tag-version | |
| - name: Install project modules | |
| run: npm ci --production | |
| - name: Publish package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm publish | |
| - name: Commit and push package modifications | |
| run: | | |
| git add package.json | |
| git add package-lock.json | |
| git commit -m "build: updated package with ${{ steps.bumper.outputs.next }} [skip ci]" | |
| git push | |
| - name: Create a release name | |
| id: release_name | |
| uses: actions/github-script@v8.0.0 | |
| with: | |
| script: | | |
| var retval = '${{ steps.bumper.outputs.next }}' | |
| if ('${{ github.event.inputs.title }}') { | |
| retval = retval.concat(' - ${{ github.event.inputs.title }}') | |
| } | |
| core.setOutput('value', retval) | |
| - name: Create and push new tag | |
| run: | | |
| git tag ${{ steps.bumper.outputs.next }} -m "${{ steps.release_name.outputs.value }}" | |
| git push origin ${{ steps.bumper.outputs.next }} | |
| - name: Create a release | |
| id: gh_release | |
| uses: actions/github-script@v8.0.0 | |
| with: | |
| github-token: ${{ secrets.RELEASE_PAT }} | |
| script: | | |
| const repo_name = context.payload.repository.full_name | |
| const response = await github.request('POST /repos/' + repo_name + '/releases', { | |
| tag_name: '${{ steps.bumper.outputs.next }}', | |
| name: '${{ steps.release_name.outputs.value }}', | |
| generate_release_notes: true | |
| }) |