wcb/.github/workflows/release.yml
Ayo b0e48e404d
Some checks are pending
Tests / Unit (push) Waiting to run
Tests / E2E (push) Waiting to run
ci: publishing
2026-07-05 17:16:02 +02:00

94 lines
2.4 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
changelog:
name: Changelog
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
# Mints the short-lived OIDC credential used for trusted publishing.
# No npm token is stored anywhere — this is the credential.
id-token: write
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
cache: pnpm
# Trusted publishing (OIDC) requires npm >= 11.5.1.
- name: Ensure npm supports trusted publishing
run: npm install -g npm@latest
- run: pnpm install --frozen-lockfile
- run: pnpm build
# No NODE_AUTH_TOKEN: npm authenticates via OIDC using the trusted
# publisher configured on npmjs.com. Provenance is generated
# automatically, so --provenance is not needed.
- name: Publish
run: npm publish --access public
publish-gh-packages:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: 'https://npm.pkg.github.com'
scope: '@ayo-run'
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build
# GitHub Packages requires a scoped name matching the repository owner.
# The scoped name applies only to this registry; npm keeps the
# unscoped "web-component-base".
- name: Scope package name for GitHub Packages
run: npm pkg set name="@ayo-run/web-component-base"
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}