Skip to content

Merge pull request #22 from Quevedin77/patch-7 #18

Merge pull request #22 from Quevedin77/patch-7

Merge pull request #22 from Quevedin77/patch-7 #18

Workflow file for this run

name: Release on Push to Main
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.3' # Adjust to your Go version
- name: Install dependencies
run: go mod tidy
- name: Get the current tag
id: get_tag
run: |
TAG=$(git describe --tags --abbrev=0)
echo "Current tag: $TAG"
echo "::set-output name=tag::$TAG"
- name: Bump version and create tag
id: bump_version
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Get the current tag
TAG=$(git describe --tags --abbrev=0)
# Extract the version number components
IFS='.' read -r -a VERSION_PARTS <<< "${TAG#v}"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
# Increment the patch version number
NEW_TAG="v$MAJOR.$MINOR.$((PATCH + 1))"
# Create a new tag
git tag $NEW_TAG
git push origin $NEW_TAG
echo "New tag: $NEW_TAG"
echo "::set-output name=new_tag::$NEW_TAG"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}