ci: add manual release workflow for @pascal-app/core and @pascal-app/viewer
This commit is contained in:
@@ -0,0 +1,109 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
package:
|
||||||
|
description: "Package to release"
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- core
|
||||||
|
- viewer
|
||||||
|
- both
|
||||||
|
bump:
|
||||||
|
description: "Version bump"
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- patch
|
||||||
|
- minor
|
||||||
|
- major
|
||||||
|
dry-run:
|
||||||
|
description: "Dry run (no publish)"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Configure npm auth
|
||||||
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
||||||
|
|
||||||
|
- name: Configure git
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Bump & publish core
|
||||||
|
if: inputs.package == 'core' || inputs.package == 'both'
|
||||||
|
working-directory: packages/core
|
||||||
|
run: |
|
||||||
|
npm version ${{ inputs.bump }} --no-git-tag-version
|
||||||
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
|
echo "CORE_VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
bun run build
|
||||||
|
|
||||||
|
if [ "${{ inputs.dry-run }}" = "true" ]; then
|
||||||
|
echo "🏜️ Dry run — would publish @pascal-app/core@$VERSION"
|
||||||
|
npm publish --dry-run
|
||||||
|
else
|
||||||
|
npm publish --access public
|
||||||
|
echo "📦 Published @pascal-app/core@$VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Bump & publish viewer
|
||||||
|
if: inputs.package == 'viewer' || inputs.package == 'both'
|
||||||
|
working-directory: packages/viewer
|
||||||
|
run: |
|
||||||
|
npm version ${{ inputs.bump }} --no-git-tag-version
|
||||||
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
|
echo "VIEWER_VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
bun run build
|
||||||
|
|
||||||
|
if [ "${{ inputs.dry-run }}" = "true" ]; then
|
||||||
|
echo "🏜️ Dry run — would publish @pascal-app/viewer@$VERSION"
|
||||||
|
npm publish --dry-run
|
||||||
|
else
|
||||||
|
npm publish --access public
|
||||||
|
echo "📦 Published @pascal-app/viewer@$VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit version bumps & tag
|
||||||
|
if: inputs.dry-run == false
|
||||||
|
run: |
|
||||||
|
git add -A
|
||||||
|
PKGS=""
|
||||||
|
TAGS=""
|
||||||
|
|
||||||
|
if [ -n "$CORE_VERSION" ]; then
|
||||||
|
PKGS="$PKGS @pascal-app/core@$CORE_VERSION"
|
||||||
|
TAGS="$TAGS @pascal-app/core@$CORE_VERSION"
|
||||||
|
fi
|
||||||
|
if [ -n "$VIEWER_VERSION" ]; then
|
||||||
|
PKGS="$PKGS @pascal-app/viewer@$VIEWER_VERSION"
|
||||||
|
TAGS="$TAGS @pascal-app/viewer@$VIEWER_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "release:${PKGS}"
|
||||||
|
|
||||||
|
for TAG in $TAGS; do
|
||||||
|
git tag "$TAG"
|
||||||
|
done
|
||||||
|
|
||||||
|
git push --follow-tags
|
||||||
Reference in New Issue
Block a user