Skip to content

Update version number #33

Update version number

Update version number #33

Workflow file for this run

name: Create Release
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Latest Release Version
id: get_version
run: |
LATEST_TAG=$(git ls-remote --tags origin | grep -o 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sed 's/refs\/tags\///' | sort -V | tail -n 1)
if [[ -z "$LATEST_TAG" ]]; then
TAG_NAME="v1.0.0" # Start from v1.0.0 if no tags found
else
if [[ $LATEST_TAG =~ v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
MAJOR=${BASH_REMATCH[1]}
MINOR=${BASH_REMATCH[2]}
PATCH=${BASH_REMATCH[3]}
PATCH=$((PATCH + 1)) # Increment patch version
TAG_NAME="v${MAJOR}.${MINOR}.${PATCH}"
else
TAG_NAME="v1.0.1" # Fallback if no valid tag found
fi
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Get Changelog
id: changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
CHANGELOG=$(git log --pretty=format:'- %s')
else
CHANGELOG=$(git log --pretty=format:'- %s' ${PREV_TAG}..HEAD)
fi
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Git Tag
run: |
git tag ${{ env.TAG_NAME }}
git push origin ${{ env.TAG_NAME }} || echo "Tag already exists, skipping push."
- name: Create GitHub Release
uses: softprops/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}
body: |
## Changelog
${{ env.CHANGELOG }}
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}