feat: prep the automation

This commit is contained in:
2026-04-24 00:40:40 +08:00
parent 7e4b707e84
commit 53f151af1d
32 changed files with 426 additions and 171 deletions
+28 -8
View File
@@ -8,24 +8,43 @@ on:
- 'scripts/**'
- 'scenes/**'
- 'assets/**'
- 'assets/data/version.json'
- 'CHANGELOG_DRAFT.md'
workflow_dispatch:
jobs:
build-and-deploy-patch:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# ── 1. Auto-generate version.json from CHANGELOG_DRAFT.md ────────────
- name: Generate Version JSON & Bump Version
run: python3 tools/generate_version_json.py
# ── 2. Commit bumped files back to the repo ───────────────────────────
- name: Commit Version Bump
run: |
git config user.name "PatchBot"
git config user.email "action@github.com"
git add assets/data/version.json project.godot CHANGELOG_DRAFT.md
git diff --staged --quiet || git commit -m "[AUTO] Version bump & changelog update"
git push
# ── 3. Detect changed files for patch PCK ────────────────────────────
- name: Generate Changed Files List
run: |
git diff --name-only HEAD^ HEAD > changed_files.txt
git diff --name-only HEAD^ HEAD -- 'scripts/**' 'scenes/**' 'assets/**' > changed_files.txt
echo "Files to patch:"
cat changed_files.txt
# ── 4. Build patch.pck ────────────────────────────────────────────────
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
@@ -35,8 +54,8 @@ jobs:
- name: Run Build Patch Script
run: godot --headless -s tools/build_patch.gd
# Push the patch files directly to the public repository structure!
- name: Push to Public Repository
# ── 5. Push patch.pck to public repo ─────────────────────────────────
- name: Push patch.pck to Public Repository
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PUBLIC_REPO_PAT }}
@@ -46,9 +65,10 @@ jobs:
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed new patch.pck via CI'
commit_message: '[AUTO] Pushed new patch.pck'
- name: Push Version Manifest to Public Repository
# ── 6. Push version.json to public repo ──────────────────────────────
- name: Push version.json to Public Repository
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PUBLIC_REPO_PAT }}
@@ -58,4 +78,4 @@ jobs:
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed new version.json via CI'
commit_message: '[AUTO] Pushed new version.json'