container/.github/workflows/viewer-publish.yml

47 lines
2 KiB
YAML

name: Viewer - Version and Release
on:
workflow_dispatch:
inputs:
newversion:
description: 'Semantic Version Bump Type (major minor patch)'
default: patch
env:
node_version: 24
defaults:
run:
working-directory: viewer
jobs:
version_and_release:
runs-on: ubuntu-latest
permissions:
contents: write # git push --follow-tags
id-token: write # OIDC trusted publishing
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4
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: npm install -g pnpm@5.17.1
- run: pnpm install
- run: git config --global user.name github-actions
- run: git config --global user.email bot@github.com
- run: yarn config set version-git-message "Viewer v%s"
- run: yarn version --${{ github.event.inputs.newversion }}
- run: sed -i 's:"container-viewer":"@boardgamers/container-viewer":' package.json
# pnpm 10.16+ supports OIDC trusted publishing and rewrites the workspace:../engine
# dependency to a real version range; publish via npx so we don't have to bump the
# repo-wide pnpm (which would force a lockfile rewrite). No NODE_AUTH_TOKEN is set, so
# publishing authenticates with the OIDC token instead of the (now-rejected) npm token.
# NODE_OPTIONS=--openssl-legacy-provider works around webpack 4 (vue-cli-service) relying
# on MD4, which OpenSSL 3 (bundled with Node >= 17) no longer supports out of the box.
- run: npx -y pnpm@latest publish . --access public --no-git-checks
env:
NODE_OPTIONS: --openssl-legacy-provider
- run: git push --follow-tags