Skip to content

Merge pull request #83 from povio/fix/builder-config-query-imports #239

Merge pull request #83 from povio/fix/builder-config-query-imports

Merge pull request #83 from povio/fix/builder-config-query-imports #239

Workflow file for this run

name: Publish to NPM
on:
push:
tags:
- v1.*
- v2.*
- v3.*
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
environment: v4
steps:
- uses: actions/checkout@v6
- run: corepack enable
- uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- name: Set package version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
export VERSION
node <<'NODE'
const fs = require("fs");
const { VERSION: version } = process.env;
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
throw new Error(`Invalid release version: ${version}`);
}
const packageJsonPath = "package.json";
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
packageJson.version = version;
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
NODE
- run: pnpm build
- run: npm pack
- name: Publish release
if: "!contains(github.ref, '-rc.')"
run: npm publish --access=public
- name: Publish release candidate
if: contains(github.ref, '-rc.')
run: npm publish --access=public --tag next