Files
tekton/.github/workflows/deploy_patch.yml
T

131 lines
5.1 KiB
YAML

name: Build and Release Patch PCK
on:
push:
branches:
- 'patch-release'
paths:
- 'scripts/**'
- 'scenes/**'
- 'assets/**'
- '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: 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 -- '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:
version: '4.3.0'
use-dotnet: false
- name: Run Build Patch Script
run: godot --headless -s tools/build_patch.gd
# ── 5. Generate checksums ─────────────────────────────────────────────────
- name: Generate Checksums
run: |
sha256sum patch.pck > patch.pck.sha256
sha256sum assets/data/version.json > version.json.sha256
# ── 6. Upload artifacts to GitHub ─────────────────────────────────────────
- name: Upload Patch Artifacts
uses: actions/upload-artifact@v4
with:
name: patch-pck-${{ github.sha }}
path: |
patch.pck
patch.pck.sha256
retention-days: 90
- name: Upload Version Manifest
uses: actions/upload-artifact@v4
with:
name: version-manifest-${{ github.sha }}
path: |
assets/data/version.json
version.json.sha256
retention-days: 90
# ── 7. 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 }}
with:
source_file: 'patch.pck'
destination_repo: '${{ github.actor }}/tekton-updates'
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed new patch.pck'
- name: Push patch checksum to Public Repository
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PUBLIC_REPO_PAT }}
with:
source_file: 'patch.pck.sha256'
destination_repo: '${{ github.actor }}/tekton-updates'
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed patch checksum'
# ── 8. 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 }}
with:
source_file: 'assets/data/version.json'
destination_repo: '${{ github.actor }}/tekton-updates'
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed new version.json'
- name: Push version checksum to Public Repository
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PUBLIC_REPO_PAT }}
with:
source_file: 'version.json.sha256'
destination_repo: '${{ github.actor }}/tekton-updates'
destination_folder: 'latest'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Pushed version checksum'