Skip to content

Publish to npm

Publish to npm #4

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Release tag to publish
required: true
default: v0.3.0
provenance:
description: Publish with npm provenance
required: true
default: "true"
type: choice
options:
- "true"
- "false"
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish
if: github.repository == 'resolute/std'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref_name }}
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: latest
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Verify release tag matches deno.json
shell: bash
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
run: |
VERSION="$(node -p "require('./deno.json').version")"
test "${RELEASE_TAG}" = "v${VERSION}"
- name: Pack release tarball
run: deno task pack:release
- name: Publish npm package
env:
NPM_PROVENANCE: ${{ inputs.provenance || 'true' }}
run: |
if [ "${NPM_PROVENANCE}" = "false" ]; then
npm publish ./*.tgz --access public --provenance=false
else
npm publish ./*.tgz --access public
fi