- 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
57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
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 }}
|