Skip to content

Publish

Publish #4

Workflow file for this run

name: Publish
on:
release:
types: [ published ]
permissions:
id-token: write # Required for OIDC authentication
contents: read # Allows checking out the repository contents
env:
PRIMARY_NODE_VERSION: 24.x
REGISTRY: https://registry.npmjs.org/
jobs:
test:
name: Run tests before publish
uses: ./.github/workflows/ci.yml
secrets: inherit
publish_version:
name: Publish
runs-on: ubuntu-latest
needs: [ test ]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: fetch
run: |
git fetch --prune --unshallow
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.REGISTRY }}
- name: Get yarn cache directory
id: yarn-cache-dir
shell: bash
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ubuntu-latest-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
ubuntu-latest-${{ env.NODE_VERSION }}-yarn-
- name: Install dependencies and build
run: |
yarn install --frozen-lockfile
yarn build
- name: Publish
run: |
npm publish