Merge pull request #83 from povio/fix/builder-config-query-imports #239
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |