Skip to content

chore: bump version to v1.0.2 #2

chore: bump version to v1.0.2

chore: bump version to v1.0.2 #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., v1.2.3)"
required: true
type: string
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
- name: Build and package
run: |
yarn build
yarn package
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "major_version=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
- name: Update major version tag
run: |
MAJOR_VERSION=${{ steps.get_version.outputs.major_version }}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Delete existing tag if it exists
git tag -d $MAJOR_VERSION || true
git push origin :refs/tags/$MAJOR_VERSION || true
# Create new tag
git tag -a $MAJOR_VERSION -m "Update $MAJOR_VERSION tag"
git push origin $MAJOR_VERSION
- name: Update release branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Delete existing release branch if it exists
git push origin :release || true
git branch -D release || true
# Create new release branch
git checkout -B release
git push origin release
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}