Publish Packages #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Packages | |
on: | |
workflow_dispatch: | |
inputs: | |
bump: | |
required: true | |
type: choice | |
options: | |
- next | |
- patch | |
- minor | |
- major | |
- prepatch | |
- preminor | |
- premajor | |
preid: | |
type: choice | |
required: true | |
default: beta | |
options: | |
- alpha | |
- beta | |
- canary | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v4 | |
- run: pnpm install | |
- run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- run: pnpm dlx bumpp -r ${{ github.event.inputs.bump }} --yes --preid=${{ github.event.inputs.preid }} | |
- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- id: package-version | |
uses: martinbeentjes/npm-get-version-action@v1 | |
# use steps.package-version.outputs.current-version for create | |
- id: prerelease-tag | |
run: | | |
VERSION=${{ steps.package-version.outputs.current-version }} | |
if [[ $VERSION =~ ^[0-9\.]+(-([0-9A-Za-z-]+).*)?$ ]]; then | |
echo "tag=${BASH_REMATCH[2]}" | |
else | |
echo "tag=unknown" | |
fi | |
- run: pnpm --filter='./packages/*' -r publish --tag="${{ steps.prerelease-tag.outputs.tag || 'latest' }}" | |
- run: pnpm dlx changelogithub | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |