Merge pull request #19 from taikoxyz/gaming #16
This file contains 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 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 }} |