make my own version bumper
This commit is contained in:
@@ -1,17 +1,46 @@
|
||||
name: Semantic Versioning
|
||||
name: Semantic Versioning for Tags
|
||||
|
||||
on: push
|
||||
# pull_request:
|
||||
# types: [closed]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- test_semserver
|
||||
|
||||
jobs:
|
||||
build:
|
||||
bump-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Tag
|
||||
uses: K-Phoen/semver-release-action@master
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
release_branch: test_semver
|
||||
release_strategy: none
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Bump Version and Tag
|
||||
run: |
|
||||
# Fetch the latest tags from the remote
|
||||
git fetch --tags
|
||||
|
||||
# Get the latest tag
|
||||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
|
||||
# Split the latest tag into parts
|
||||
IFS='.' read -r -a parts <<< "${latest_tag#v}"
|
||||
|
||||
# Increment the patch version
|
||||
major=${parts[0]}
|
||||
minor=${parts[1]}
|
||||
patch=${parts[2]}
|
||||
new_patch=$((patch + 1))
|
||||
|
||||
# Create a new tag
|
||||
new_tag="v$major.$minor.$new_patch"
|
||||
|
||||
echo "Bumping version from $latest_tag to $new_tag"
|
||||
|
||||
# Tag the new version
|
||||
git tag $new_tag
|
||||
|
||||
# Configure GitHub token authentication
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
|
||||
# Push the new tag to the remote repository
|
||||
git push origin $new_tag
|
||||
|
||||
Reference in New Issue
Block a user