Skip to content

Commit

Permalink
auto increment update
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Nov 3, 2024
1 parent b63ed7b commit 5a22161
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ jobs:
- name: Increment version and build with Maven
id: increment-version
run: |
START_VERSION="2.0.1903"
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$CURRENT_VERSION" == "0.0.1-SNAPSHOT" ]]; then
NEW_VERSION=$START_VERSION
else
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F '.' '{print $1"."$2"."$3+1}')
fi
BASE_VERSION="2.0"
BUILD_NUMBER=${{ github.run_number }}
NEW_VERSION="${BASE_VERSION}.${BUILD_NUMBER}"
echo "New version: $NEW_VERSION"
echo "artifact-version=$NEW_VERSION" >> $GITHUB_ENV
Expand Down Expand Up @@ -117,7 +113,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git tag -l | grep -q "v${{ env.artifact-version }}"; then
echo "Tag v${{ env.artifact-version }} already exists. Skipping tag creation."
else
git config user.name "github-actions"
git config user.email "[email protected]"
git tag -a "v${{ env.artifact-version }}" -m "Release version ${{ env.artifact-version }}"
git push origin "v${{ env.artifact-version }}"
fi

0 comments on commit 5a22161

Please sign in to comment.