Publish #13
This file contains 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: | |
target_element: | |
description: 'Semver element will be incremented' | |
required: true | |
default: patch | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yaml | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Verify npmjs access token (this step will fail if the token has expired) | |
run: npm whoami | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Configure git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
- name: Bump version | |
run: | | |
npm version ${{ inputs.target_element }} \ | |
--include-workspace-root \ | |
--no-git-tag-version \ | |
-w packages/bolt-s3 \ | |
-w packages/bolt-dynamodb | |
- name: Get version string | |
id: get-version-string | |
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT" | |
- run: | | |
git add \ | |
package.json \ | |
package-lock.json \ | |
packages/bolt-s3/package.json \ | |
packages/bolt-dynamodb/package.json | |
- run: git commit -m "v${{ steps.get-version-string.outputs.version }}" | |
- run: git tag "v${{ steps.get-version-string.outputs.version }}" | |
- run: npm ci | |
- run: make publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: git push | |
- run: git push origin "v${{ steps.get-version-string.outputs.version }}" |