Skip to content

chore(release): 0.0.1-dev.1 #6

chore(release): 0.0.1-dev.1

chore(release): 0.0.1-dev.1 #6

Workflow file for this run

name: Release
# Publishes a version to the npm registry. The trust relationship grants
# `npm publish` over OIDC, so pushing a tag releases the version with no human
# step. A version is public the moment this workflow succeeds.
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
dist_tag:
description: 'Override the npm dist-tag (default: latest)'
required: false
default: ''
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22.x'
cache: npm
registry-url: https://registry.npmjs.org
# `--provenance` needs npm 9.5.0 or newer; pin a current major instead.
- run: npm install -g npm@^12.0.0
- run: npm ci
- run: npm run build
- run: npm run typecheck
- run: npm test
- id: meta
run: |
version=$(node -p "require('./package.json').version")
if [ "$GITHUB_REF_TYPE" = tag ] && [ "$GITHUB_REF_NAME" != "v$version" ]; then
echo "git tag $GITHUB_REF_NAME does not match package version $version" >&2
exit 1
fi
# Pre-1.0 dev builds are the newest thing this package has, so a bare
# `npm install qca-sdk` should resolve to them. The OIDC token cannot
# run `npm dist-tag`, so the tag has to be decided here.
tag="${{ github.event.inputs.dist_tag }}"
if [ -z "$tag" ]; then
tag=latest
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
# Authenticates through the npm trust relationship (OIDC); no token needed.
- run: npm publish --tag '${{ steps.meta.outputs.tag }}' --access public --provenance
- run: |
echo "Published qca-sdk@${{ steps.meta.outputs.version }} under tag ${{ steps.meta.outputs.tag }}." >> "$GITHUB_STEP_SUMMARY"
echo 'Verify: `npm view qca-sdk@${{ steps.meta.outputs.version }}` and `npm audit signatures`.' >> "$GITHUB_STEP_SUMMARY"