Files
awesome-cordova-plugins/.github/workflows/release-please.yml
T
Daniel Sogl 9818f74831 ci: publish to npm via trusted publishing (OIDC)
npm validates the OIDC claim of the entry-point workflow, not the one that
runs `npm publish`. Calling publish.yml via workflow_call meant the trust
check could never match, so the publish job moves inline into
release-please.yml and publish.yml is removed.

setup-node with Node 22 ships npm 10.x; trusted publishing needs >= 11.5.1,
hence the explicit npm upgrade before publishing.

NPM_TOKEN stays as a fallback for packages that have no trusted publisher
yet — a brand new plugin cannot get one until it exists on npm. OIDC takes
precedence wherever a config is present.

Adds scripts/tasks/trust-packages.sh to configure the trusted publisher for
all 258 packages; npm has no multi-package call and `npm trust` requires
interactive 2FA, so it runs locally, in parallel, and is resumable.
2026-07-27 21:18:10 +02:00

72 lines
1.9 KiB
YAML

name: Release Please
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- name: Run Release Please
id: release
uses: googleapis/release-please-action@v4.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# npm trusted publishing validates the OIDC claim of the *entry point* workflow,
# not the one that runs `npm publish`. Keep this job inline — a reusable workflow
# here breaks the trust check. See https://github.com/npm/documentation/issues/1755
publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4.3.1
- name: Setup Node.js
uses: actions/setup-node@v4.4.0
with:
node-version: 22
cache: npm
registry-url: https://registry.npmjs.org
# node 22 ships npm 10.x; trusted publishing (OIDC) requires npm >= 11.5.1
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint -- --quiet
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Publish to npm
env:
# fallback for packages without a trusted publisher yet (e.g. brand new plugins).
# OIDC takes precedence whenever the package has one configured.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run npmpub