feat(HAI-081): add changesets-based automated versioning and release workflow
- Install and configure @changesets/cli with commit/access settings - Create version PR workflow (.github/workflows/version.yml) for automated version bumps - Update existing release and test-release workflows with version validation - Add example changeset and version tests for CI verification - Add RELEASING.md guide and update README with versioning documentation
This commit is contained in:
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -45,6 +45,21 @@ jobs:
|
||||
- name: Install Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Extract version from tag
|
||||
run: |
|
||||
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
echo "Releasing version: ${VERSION}"
|
||||
|
||||
- name: Verify tag matches package version
|
||||
run: |
|
||||
PKG_VERSION=$(node -p "require('./packages/cli/package.json').version")
|
||||
if [ "$RELEASE_VERSION" != "$PKG_VERSION" ]; then
|
||||
echo "ERROR: Tag version ($RELEASE_VERSION) does not match packages/cli/package.json version ($PKG_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
echo "Version check passed: $RELEASE_VERSION"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
|
||||
56
.github/workflows/version.yml
vendored
Normal file
56
.github/workflows/version.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Version Packages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
version:
|
||||
name: Version Packages
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Create Release Pull Request or Tag
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
version: pnpm release:version
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Push version tag
|
||||
if: steps.changesets.outputs.hasChangesets == 'false'
|
||||
run: |
|
||||
VERSION=$(node -p "require('./packages/cli/package.json').version")
|
||||
TAG="v${VERSION}"
|
||||
|
||||
# Check if tag already exists
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG already exists, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user