Skip to content

Commit

Permalink
automate release as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean DeLongchamp committed Dec 9, 2024
1 parent 8b97256 commit 117d77c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/auto-versioning.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Automatic Versioning"
name: Automatic Versioning and Release

on:
push: {}
# branches:
# - main # Replace with your default branch if different
# - main # Replace with your target branch if different

jobs:
auto-version:
Expand All @@ -13,22 +13,29 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Fetch All Tags
run: |
git fetch --tags
- name: Determine Version Tag
id: versioning
run: |
DATE=$(date -u +"%Y.%m.%d")
BASE_TAG="$DATE"
# Fetch all existing tags matching the current date
EXISTING_TAGS=$(git tag -l "${BASE_TAG}.*" | sort -V)
if [ -z "$EXISTING_TAGS" ]; then
NEW_TAG="${BASE_TAG}.01"
else
LAST_TAG=$(echo "$EXISTING_TAGS" | tail -n 1)
LAST_INCREMENT=$(echo $LAST_TAG | awk -F. '{print $NF}')
LAST_INCREMENT=$(echo "$LAST_TAG" | awk -F. '{print $NF}')
NEW_INCREMENT=$(printf "%02d" $((10#$LAST_INCREMENT + 1)))
NEW_TAG="${BASE_TAG}.${NEW_INCREMENT}"
fi
echo "Existing Tags: $EXISTING_TAGS"
echo "Last Tag: $LAST_TAG"
echo "New Tag: $NEW_TAG"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
echo "Generated version tag: $NEW_TAG"
- name: Create and Push Tag
env:
Expand Down

0 comments on commit 117d77c

Please sign in to comment.