100 lines
2.3 KiB
YAML
100 lines
2.3 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
|
|
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
|
|
|
|
- name: Ensure npm supports trusted publishing
|
|
run: npm install -g npm@latest
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm build
|
|
|
|
- name: Publish
|
|
run: |
|
|
VERSION="$(node -p "require('./package.json').version")"
|
|
if [[ "$VERSION" == *-* ]]; then
|
|
TAG="${VERSION#*-}"; TAG="${TAG%%.*}"
|
|
else
|
|
TAG="latest"
|
|
fi
|
|
echo "Publishing $VERSION to dist-tag '$TAG'"
|
|
npm publish --access public --tag "$TAG"
|
|
|
|
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'
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm build
|
|
|
|
- name: Scope package name for GitHub Packages
|
|
run: npm pkg set name="web-component-base"
|
|
|
|
- name: Publish
|
|
run: |
|
|
VERSION="$(node -p "require('./package.json').version")"
|
|
if [[ "$VERSION" == *-* ]]; then
|
|
TAG="${VERSION#*-}"; TAG="${TAG%%.*}"
|
|
else
|
|
TAG="latest"
|
|
fi
|
|
echo "Publishing $VERSION to dist-tag '$TAG'"
|
|
npm publish --tag "$TAG"
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|