mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-24 16:06:34 +00:00
feat(ci): add PR-based release flow with auto-tagging
This commit is contained in:
@@ -12,7 +12,7 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
environment: npm-publish
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -41,3 +41,13 @@ jobs:
|
||||
|
||||
- name: Publish hyperframes (CLI)
|
||||
run: pnpm --filter hyperframes publish --access public --provenance --no-git-checks
|
||||
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
gh release create "v${VERSION}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--title "v${VERSION}" \
|
||||
--generate-notes
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Tag Release
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
name: Create release tag
|
||||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Extract version and create tag
|
||||
run: |
|
||||
VERSION="${{ github.event.pull_request.head.ref }}"
|
||||
VERSION="${VERSION#release/}"
|
||||
echo "Tagging ${VERSION}"
|
||||
git tag "${VERSION}"
|
||||
git push origin "${VERSION}"
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Prepare Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version to release (e.g., 0.2.0, 1.0.0-beta.1)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare release PR
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Bump versions
|
||||
run: pnpm set-version ${{ inputs.version }}
|
||||
|
||||
- name: Create release PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
BRANCH="release/v${{ inputs.version }}"
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git checkout -b "$BRANCH"
|
||||
git add packages/*/package.json
|
||||
git commit -m "chore: release v${{ inputs.version }}"
|
||||
git push origin "$BRANCH"
|
||||
gh pr create \
|
||||
--title "chore: release v${{ inputs.version }}" \
|
||||
--body "$(cat <<'BODY'
|
||||
## Release v${{ inputs.version }}
|
||||
|
||||
Bumps all packages to v${{ inputs.version }}.
|
||||
|
||||
**After merging**, the release tag is created automatically, which triggers npm publish.
|
||||
BODY
|
||||
)" \
|
||||
--base main \
|
||||
--head "$BRANCH"
|
||||
Reference in New Issue
Block a user