Skip to content

Prepare Release

Prepare Release #21

name: Prepare Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release Type'
type: choice
options:
- 'graduate'
- 'prerelease'
required: true
default: 'prerelease'
target_branch:
description: 'Target Branch'
type: choice
options:
- 'master'
- 'next'
required: true
default: 'next'
preid:
description: 'Prefix Id'
type: choice
options:
- 'latest'
- 'next'
- 'rc'
- 'dev'
- 'alpha'
- 'beta'
required: true
default: 'next'
exact_version:
description: 'Exact Version'
type: string
required: false
permissions:
contents: write
id-token: write
jobs:
e2e:
name: E2E Release Simulation
uses: ./.github/workflows/e2e-release.yml
with:
target_branch: ${{ github.event.inputs.target_branch }}
permissions:
contents: write
id-token: write
tag-version:
name: Tag Version
needs: [e2e]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.event.inputs.target_branch }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Config Git User
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Prerelease Version (Exact Version)
if: ${{ github.event.inputs.release_type == 'prerelease' && github.event.inputs.exact_version }}
run: |
npx lerna version ${{ github.event.inputs.exact_version }} --yes --no-changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prerelease Version
if: ${{ github.event.inputs.release_type == 'prerelease' && !github.event.inputs.exact_version }}
run: |
npx lerna version --yes \
--conventional-commits \
--conventional-prerelease \
--preid ${{ github.event.inputs.preid }} \
--no-changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Graduate Version
if: ${{ github.event.inputs.release_type == 'graduate' }}
run: npx lerna version --conventional-graduate --yes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Changes to Branch
run: |
git push origin ${{ github.event.inputs.target_branch }} --no-verify
git push origin --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Release Summary
run: |
echo "## ✅ Release Prepared" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** \`${{ github.event.inputs.target_branch }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Release Type:** \`${{ github.event.inputs.release_type }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Preid:** \`${{ github.event.inputs.preid }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Tagged Packages" >> $GITHUB_STEP_SUMMARY
git tag --sort=-creatordate | head -10 | while read tag; do
echo "- \`$tag\`" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🚀 Next Steps" >> $GITHUB_STEP_SUMMARY
echo "Run the **Publish Packages** workflow to publish to npm" >> $GITHUB_STEP_SUMMARY