make my own version bumper
This commit is contained in:
@@ -1,17 +1,46 @@
|
|||||||
name: Semantic Versioning
|
name: Semantic Versioning for Tags
|
||||||
|
|
||||||
on: push
|
on:
|
||||||
# pull_request:
|
push:
|
||||||
# types: [closed]
|
branches:
|
||||||
|
- test_semserver
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
bump-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Tag
|
- name: Checkout Repository
|
||||||
uses: K-Phoen/semver-release-action@master
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
release_branch: test_semver
|
fetch-depth: 0
|
||||||
release_strategy: none
|
|
||||||
env:
|
- name: Bump Version and Tag
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
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