Skip to content

chore: bump version to 1.0.12 #4

chore: bump version to 1.0.12

chore: bump version to 1.0.12 #4

Workflow file for this run

name: Release Workflow
on:
push:
branches: [main]
paths:
- 'package.json'
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
default: patch
jobs:
release:
runs-on: ubuntu-latest
# Skip if commit is from github-actions bot or contains [skip ci]
if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'github-actions[bot]'"
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GA_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install dependencies
run: pnpm install
- name: Get current version
id: current-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Current version: $VERSION"
- name: Check if tag exists
id: check-tag
run: |
VERSION="${{ steps.current-version.outputs.version }}"
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag v$VERSION already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag v$VERSION does not exist"
fi
- name: Install auto-changelog globally
if: steps.check-tag.outputs.exists == 'false'
run: |
npm install -g auto-changelog
- name: Generate changelog
if: steps.check-tag.outputs.exists == 'false'
run: |
auto-changelog --template keepachangelog --commit-limit false --unreleased
- name: Create and push tag
if: steps.check-tag.outputs.exists == 'false'
run: |
VERSION="${{ steps.current-version.outputs.version }}"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Add changelog if it was updated
git add CHANGELOG.md
# Check if there are changes to commit
if ! git diff --staged --quiet; then
git commit -m "docs: auto-update changelog for v$VERSION [skip ci]"
git push origin main
fi
# Create annotated tag
git tag -a "v$VERSION" -m "Release v$VERSION"
git push origin "v$VERSION"
echo "✅ Created and pushed tag v$VERSION"
- name: Create GitHub Release
if: steps.check-tag.outputs.exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_TOKEN }}
with:
tag_name: v${{ steps.current-version.outputs.version }}
release_name: Release v${{ steps.current-version.outputs.version }}
body: |
🚀 **Release v${{ steps.current-version.outputs.version }}**
## What's Changed
Check the [CHANGELOG.md](https://github.com/chess-labs/core/blob/main/CHANGELOG.md) for detailed changes.
**Full Changelog**: https://github.com/chess-labs/core/compare/v${{ steps.current-version.outputs.version }}...HEAD
draft: false
prerelease: false
- name: Skip message
if: steps.check-tag.outputs.exists == 'true'
run: |
echo "⏭️ Tag v${{ steps.current-version.outputs.version }} already exists, skipping release"