From a8f08edf6807e4ea6d2a1f6bfb0138bc8a4a7eb4 Mon Sep 17 00:00:00 2001 From: McCloudS <64094529+McCloudS@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:50:08 -0700 Subject: [PATCH] Cleaning up versioning to make it a bit shorter --- .github/workflows/calver.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/calver.yml b/.github/workflows/calver.yml index c690e41..2181507 100644 --- a/.github/workflows/calver.yml +++ b/.github/workflows/calver.yml @@ -18,17 +18,27 @@ jobs: with: fetch-depth: 0 + - name: Generate Monthly Commit Count + id: commit_count + run: | + # Get the current year and month + YEAR=$(date +%Y) + MONTH=$(date +%m) + + # Count commits from the start of the current month + COMMIT_COUNT=$(git rev-list --count HEAD --since="$YEAR-$MONTH-01") + echo "commit_count=$COMMIT_COUNT" >> $GITHUB_ENV + - name: Set Calver Version - uses: Nelyx/action-calver@v1.0.0 id: setcalver - with: - default_branch: 'refs/heads/main' - format: 'YYYY.M.D' - version_prefix: '' + run: | + # Combine year, month, and commit count for the version + VERSION=$(date +%Y.%m).${{ env.commit_count }} + echo "package_version=$VERSION" >> $GITHUB_ENV - name: Update version file run: | - sed -i "s/subgen_version =.*/subgen_version = '${{ steps.setcalver.outputs.package_version }}'/" subgen.py + sed -i "s/subgen_version =.*/subgen_version = '${{ env.package_version }}'/" subgen.py - name: Amend commit with version update env: