Cleaning up versioning to make it a bit shorter
This commit is contained in:
22
.github/workflows/calver.yml
vendored
22
.github/workflows/calver.yml
vendored
@@ -18,17 +18,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
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
|
- name: Set Calver Version
|
||||||
uses: Nelyx/action-calver@v1.0.0
|
|
||||||
id: setcalver
|
id: setcalver
|
||||||
with:
|
run: |
|
||||||
default_branch: 'refs/heads/main'
|
# Combine year, month, and commit count for the version
|
||||||
format: 'YYYY.M.D'
|
VERSION=$(date +%Y.%m).${{ env.commit_count }}
|
||||||
version_prefix: ''
|
echo "package_version=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update version file
|
- name: Update version file
|
||||||
run: |
|
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
|
- name: Amend commit with version update
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user