- Stop rewriting package names to @boardgamers/* before publish: trusted publishing on npmjs.com is configured for the original unscoped powergrid-engine / powergrid-viewer packages, so the rewrite caused E404 because the OIDC exchange has no trust relationship for the scoped names. - Update each package.json's repository, homepage and bugs fields to point at boardgamers/powergrid (with a directory subpath) instead of the now-defunct LucasAMello/powergrid-engine fork. - Switch the publish step to pnpm@latest via npx so we get both OIDC trusted-publishing support (pnpm >= 10.16) and the workspace: protocol rewrite that npm publish does not perform, without bumping the repo-wide packageManager. Made-with: Cursor
51 lines
2 KiB
YAML
51 lines
2 KiB
YAML
name: Engine - Version and Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
newversion:
|
|
description: 'Semantic Version Bump Type'
|
|
type: choice
|
|
required: true
|
|
default: patch
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
|
|
env:
|
|
node_version: 24
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: engine
|
|
|
|
jobs:
|
|
version_and_release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Use Node.js ${{ env.node_version }}
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
# registry-url is required so npm publish targets the public npm registry
|
|
registry-url: 'https://registry.npmjs.org'
|
|
- run: corepack enable
|
|
- run: pnpm install
|
|
- run: git config --global user.name github-actions
|
|
- run: git config --global user.email bot@github.com
|
|
- run: |
|
|
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
BUMPED_VERSION=$(node -p "require('semver').inc('$PACKAGE_VERSION', '${{ github.event.inputs.newversion }}')")
|
|
# Update package.json with the new version
|
|
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '$BUMPED_VERSION'; fs.writeFileSync('./package.json', JSON.stringify(package, null, '\t') + '\n');"
|
|
git add .
|
|
git commit -m "🔖 powergrid-engine $BUMPED_VERSION"
|
|
# pnpm 10.16+ supports OIDC trusted publishing; use it directly to avoid bumping the
|
|
# repo-wide packageManager (currently pnpm 7) which would force a lockfile rewrite.
|
|
- run: npx -y pnpm@latest publish --access public --no-git-checks
|
|
- run: git push --follow-tags
|