Skip to content

Commit

Permalink
feat: publish workflow 20
Browse files Browse the repository at this point in the history
  • Loading branch information
unnoq committed Dec 1, 2024
1 parent f80e051 commit c3d3546
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 71 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/publish.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Bump version (e.g., 4.0.0, 4.1.0-alpha.1, 5.0.0-beta.2)'
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:

- id: version
run: |
VERSION="${{ github.event.inputs.version }}"
if [[ $VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([a-z]+)\.([1-9][0-9]*))?$ ]]; then
if [[ "${BASH_REMATCH[5]}" == "latest" ]]; then
echo "INVALID VERSION FORMAT ('latest' is not allowed): $VERSION" >&2
exit 1
fi
echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "minor=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "patch=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
echo "preid=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
echo "number=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
else
echo "INVALID VERSION FORMAT: $VERSION" >&2
exit 1
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4

- run: pnpm i

- 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.version }} --yes --preid=${{ steps.version.outputs.preid }}

- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm --filter='./packages/*' -r publish --tag="${{ steps.version.outputs.preid || 'latest' }}"

- run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c3d3546

Please sign in to comment.