v3.20.0 #106
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| version-and-changelog: | |
| name: Update Version and Changelog | |
| runs-on: ubuntu-latest | |
| # Skip pre-releases and tags with pre-release suffixes (e.g., v3.4.5-pre1, v3.4.5-alpha1) | |
| if: github.event.release.prerelease == false && !contains(github.event.release.tag_name, '-') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Update version from release tag | |
| run: | | |
| RELEASE_TAG="${{ github.event.release.tag_name }}" | |
| RELEASE_VERSION="${RELEASE_TAG#v}" | |
| echo "Release tag: $RELEASE_TAG" | |
| echo "Release version: $RELEASE_VERSION" | |
| # Update version in package.json | |
| RELEASE_VERSION="$RELEASE_VERSION" node -e " | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | |
| pkg.version = process.env.RELEASE_VERSION; | |
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 4) + '\n'); | |
| " | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "Updated package.json version to: $NEW_VERSION" | |
| # Check if there are changes to commit | |
| if [[ -n $(git status --porcelain) ]]; then | |
| git add . | |
| git commit -m "chore: version ${{ github.event.release.tag_name }} [skip ci]" | |
| git push origin main | |
| echo "✅ Version updated" | |
| else | |
| echo "ℹ️ Version already up to date" | |
| fi |