Skip to content

Publish to npm

Publish to npm #5

Workflow file for this run

name: Publish to GitHub Packages
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
publish:
if: github.repository == 'deckflow/html-editor'
runs-on: ubuntu-latest
steps:
- name: Check out the release
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://npm.pkg.github.com'
scope: '@deckflow'
package-manager-cache: false
- name: Install dependencies
run: npm ci
- name: Verify release tag
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: >-
node --input-type=module -e '
import { readFileSync } from "node:fs";
const { version } = JSON.parse(readFileSync("package.json", "utf8"));
const tag = process.env.RELEASE_TAG;
if (tag && tag !== version && tag !== `v${version}`) {
throw new Error(`Release tag ${tag} does not match package version ${version}`);
}
console.log(`Publishing @deckflow/html-editor@${version}`);
'
- name: Test package
run: npm test
- name: Inspect package contents
run: npm pack --dry-run
- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}