chore: update release workflow (#741) #174
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: "Release" | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 20 | |
always-auth: true | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Run checks | |
run: yarn run test && yarn lint && yarn build | |
# Use an app to authenticate to trigger workflows on the repository | |
- name: Get app installation token | |
uses: actions/create-github-app-token@https://github.com/actions/create-github-app-token/commit/5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | |
id: app-token | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v.1.3 | |
id: release | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
release-type: node | |
- name: Publish to NPM | |
run: yarn publish | |
if: ${{ steps.release.outputs.release_created }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |