- Update .gitignore for new backend structure - Update GitHub workflows for transcriptarr rename - Update launcher.py to use new module name
56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Update_CalVer_Amend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths:
|
|
- '../../transcriptarr.py'
|
|
workflow_dispatch: # Allow manual triggering
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # Crucial for getting full history
|
|
|
|
- name: Calculate version
|
|
id: version
|
|
run: |
|
|
YEAR=$(date +%Y)
|
|
MONTH=$(date +%m)
|
|
COMMIT_COUNT=$(git rev-list --count HEAD --since="$YEAR-$MONTH-01")
|
|
echo "COMMIT_COUNT=$COMMIT_COUNT"
|
|
echo "VERSION=${YEAR}.${MONTH}.${COMMIT_COUNT}" >> $GITHUB_ENV
|
|
|
|
- name: Update transcriptarr.py with version
|
|
run: |
|
|
sed -i "s/subgen_version =.*/subgen_version = '${{ env.VERSION }}'/" subgen.py
|
|
|
|
- name: Check if transcriptarr.py was actually changed (compare with HEAD)
|
|
id: check_change
|
|
run: |
|
|
if git diff --quiet HEAD subgen.py; then
|
|
echo "::set-output name=changed::false"
|
|
else
|
|
echo "::set-output name=changed::true"
|
|
fi
|
|
|
|
- name: Amend commit if transcriptarr.py changed
|
|
if: steps.check_change.outputs.changed == 'true'
|
|
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}"
|
|
|
|
git add subgen.py
|
|
git commit --amend --reuse-message=HEAD --author="${GIT_AUTHOR_NAME} <${GIT_AUTHOR_EMAIL}>" # Amend the last commit
|
|
|
|
# Push with force-with-lease (safer than --force)
|
|
git push --force-with-lease origin HEAD:main
|