diff --git a/.github/workflows/calver.yml b/.github/workflows/calver.yml index 84508a4..c690e41 100644 --- a/.github/workflows/calver.yml +++ b/.github/workflows/calver.yml @@ -10,7 +10,6 @@ on: workflow_dispatch: jobs: - docker: runs-on: ubuntu-latest steps: @@ -18,6 +17,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set Calver Version uses: Nelyx/action-calver@v1.0.0 id: setcalver @@ -25,14 +25,24 @@ jobs: default_branch: 'refs/heads/main' format: 'YYYY.M.D' version_prefix: '' + - name: Update version file run: | sed -i "s/subgen_version =.*/subgen_version = '${{ steps.setcalver.outputs.package_version }}'/" subgen.py - - - name: Commit and push changes + + - name: Amend commit with version update + env: + GIT_AUTHOR_NAME: "McCloudS" + GIT_AUTHOR_EMAIL: "scott@mccloud.dev" run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" + git config user.name "${GIT_AUTHOR_NAME}" + git config user.email "${GIT_AUTHOR_EMAIL}" + + # Stage the modified file git add subgen.py - git commit -m "Automated update subgen.py with version" - git push + + # Amend the most recent commit, reusing the previous commit message + git commit --amend --reuse-message=HEAD --author="${GIT_AUTHOR_NAME} <${GIT_AUTHOR_EMAIL}>" + + # Push the amended commit + git push --force