Test: create tag 2 #major #11
Workflow file for this run
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: Versioning | |
on: | |
push: | |
branches: | |
- dbp-557-implement-semV # main | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
#- name: Fetch all tags | |
# run: git fetch --tags | |
- name: Get current version #--abbrev=0 ----Commit-Hash | |
run: | | |
git fetch --tags | |
echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV | |
- name: Determine version type | |
run: | | |
version=${{ env.VERSION }} | |
major=$(echo "$version" | cut -d '.' -f 1 ) | |
minor=$(echo "$version" | cut -d '.' -f 2) | |
patch=$(echo "$version" | cut -d '.' -f 3) | |
if git log -1 --pretty=%B | grep -q '#major'; then | |
new_version="v$((major+1)).0.0" | |
elif git log -1 --pretty=%B | grep -q '#minor'; then | |
new_version="v$major.$((minor+1)).0" | |
else | |
new_version="v$major.$minor.$((patch+1))" | |
fi | |
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV | |
- name: Create new tag | |
if: ${{ github.ref == 'refs/heads/dbp-557-implement-semV' }} # main | |
uses: anothrNick/github-tag-action@a2c70ae13a881faf2b4953baaa9e49731997ab36 | |
with: | |
tag: ${{ env.NEW_VERSION }} | |
message: 'New version ${{ env.NEW_VERSION }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |