49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: Update_CalVer
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths:
|
|
- 'subgen.py'
|
|
- 'launcher.py'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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: ''
|
|
|
|
- name: Update version file
|
|
run: |
|
|
sed -i "s/subgen_version =.*/subgen_version = '${{ steps.setcalver.outputs.package_version }}'/" subgen.py
|
|
|
|
- name: Amend commit with version update
|
|
env:
|
|
GIT_AUTHOR_NAME: "McCloudS"
|
|
GIT_AUTHOR_EMAIL: "scott@mccloud.dev"
|
|
run: |
|
|
git config user.name "${GIT_AUTHOR_NAME}"
|
|
git config user.email "${GIT_AUTHOR_EMAIL}"
|
|
|
|
# Stage the modified file
|
|
git add subgen.py
|
|
|
|
# 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
|