feat: edit CI/CD

This commit is contained in:
2026-07-01 18:33:08 +08:00
parent 5b34f8b96f
commit d2156c6d1a
4 changed files with 0 additions and 494 deletions
-128
View File
@@ -1,128 +0,0 @@
name: Build and Export
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to build (e.g., 2.4.0)'
required: true
type: string
jobs:
build-windows:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: '4.6.0'
use-dotnet: false
- name: Setup Export Templates
run: |
TEMPLATES_DIR=~/.local/share/godot/export_templates/4.6.stable
mkdir -p "$TEMPLATES_DIR"
wget -q https://github.com/godotengine/godot/releases/download/4.6-stable/Godot_v4.6-stable_export_templates.tpz -O templates.tpz
unzip -q templates.tpz -d "$TEMPLATES_DIR"
mv "$TEMPLATES_DIR/templates/"* "$TEMPLATES_DIR/"
rmdir "$TEMPLATES_DIR/templates"
- name: Export Windows Build
run: |
mkdir -p build
godot --headless --export-release "Windows Desktop" build/tekton_armageddon_windows.exe
- name: Zip Windows Build
run: cd build && zip tekton_armageddon_windows.zip tekton_armageddon_windows.exe
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: build/tekton_armageddon_windows.zip
retention-days: 30
build-linux:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: '4.6.0'
use-dotnet: false
- name: Setup Export Templates
run: |
TEMPLATES_DIR=~/.local/share/godot/export_templates/4.6.stable
mkdir -p "$TEMPLATES_DIR"
wget -q https://github.com/godotengine/godot/releases/download/4.6-stable/Godot_v4.6-stable_export_templates.tpz -O templates.tpz
unzip -q templates.tpz -d "$TEMPLATES_DIR"
mv "$TEMPLATES_DIR/templates/"* "$TEMPLATES_DIR/"
rmdir "$TEMPLATES_DIR/templates"
- name: Export Linux Build
run: |
mkdir -p build
godot --headless --export-release "Linux/X11" build/tekton_armageddon_linux.x86_64
- name: Zip Linux Build
run: cd build && zip tekton_armageddon_linux.zip tekton_armageddon_linux.x86_64
- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
with:
name: linux-build
path: build/tekton_armageddon_linux.zip
retention-days: 30
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
if: always() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Extract Version
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download All Artifacts
uses: actions/download-artifact@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
windows-build/tekton_armageddon_windows.zip
linux-build/tekton_armageddon_linux.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Mirror to tekton-updates
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_PAT }}
run: |
gh release create "v${{ steps.version.outputs.version }}" \
--repo "${{ github.actor }}/tekton-updates" \
--title "v${{ steps.version.outputs.version }}" \
--notes "Mirror of https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.version }}" \
"windows-build/tekton_armageddon_windows.zip#Windows" \
"linux-build/tekton_armageddon_linux.zip#Linux"
-177
View File
@@ -1,177 +0,0 @@
name: Build Platform Artifacts
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to build (e.g., 2.4.0)'
required: true
type: string
jobs:
build-artifacts:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
platform:
- name: Windows
preset: "Windows Desktop"
extension: exe
- name: Linux
preset: "Linux/X11"
extension: x86_64
- name: Android
preset: "Android"
extension: apk
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: '4.6.0'
use-dotnet: false
- name: Setup Export Templates
run: |
TEMPLATES_DIR=~/.local/share/godot/export_templates/4.6.stable
mkdir -p "$TEMPLATES_DIR"
wget -q https://github.com/godotengine/godot/releases/download/4.6-stable/Godot_v4.6-stable_export_templates.tpz -O templates.tpz
unzip -q templates.tpz -d "$TEMPLATES_DIR"
mv "$TEMPLATES_DIR/templates/"* "$TEMPLATES_DIR/"
rmdir "$TEMPLATES_DIR/templates"
- name: Setup Android SDK (Android only)
if: matrix.platform.name == 'Android'
uses: android-actions/setup-android@v3
- name: Extract Version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Create Build Directory
run: mkdir -p build
- name: Export Game
run: |
godot --headless --export-release "${{ matrix.platform.preset }}" \
"build/tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.${{ matrix.platform.extension }}"
- name: Generate Checksums
run: |
cd build
sha256sum tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.${{ matrix.platform.extension }} \
> tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.sha256
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: tekton-${{ matrix.platform.name }}-v${{ steps.version.outputs.version }}
path: |
build/tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.${{ matrix.platform.extension }}
build/tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.sha256
retention-days: 90
compression-level: 0
- name: Create Release Asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
build/tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.${{ matrix.platform.extension }}
build/tekton_armageddon_${{ matrix.platform.name }}_v${{ steps.version.outputs.version }}.sha256
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-patch:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: '4.6.0'
use-dotnet: false
- name: Extract Version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Generate Changed Files List
run: |
find scripts/ scenes/ assets/ -type f > changed_files.txt
echo "Patching $(wc -l < changed_files.txt) files"
- name: Build Patch PCK
run: godot --headless -s tools/build_patch.gd
- name: Generate Patch Checksum
run: |
sha256sum patch.pck > patch.pck.sha256
- name: Upload Patch Artifact
uses: actions/upload-artifact@v4
with:
name: tekton-patch-v${{ steps.version.outputs.version }}
path: |
patch.pck
patch.pck.sha256
retention-days: 90
- name: Push to Updates Repository
if: startsWith(github.ref, 'refs/tags/')
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: 'v${{ steps.version.outputs.version }}'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Release v${{ steps.version.outputs.version }} patch'
- name: Push Checksum to Updates Repository
if: startsWith(github.ref, 'refs/tags/')
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: 'v${{ steps.version.outputs.version }}'
user_email: 'action@github.com'
user_name: 'PatchBot'
commit_message: '[AUTO] Release v${{ steps.version.outputs.version }} checksum'
-130
View File
@@ -1,130 +0,0 @@
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.6.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'
-59
View File
@@ -1,59 +0,0 @@
name: Automated Testing
on:
push:
branches:
- main
- develop
- 'feature/**'
- 'patch-release'
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: '4.6.0'
use-dotnet: false
- name: Verify GUT Installation
run: |
if [ ! -d "addons/gut" ]; then
echo "ERROR: GUT addon not found at addons/gut"
exit 1
fi
echo "GUT addon found"
- name: Run Unit Tests
run: |
godot --headless --path . -s res://addons/gut/gut_cmdln.gd \
-gdir=res://tests/ \
-gexit \
-glog=2
- name: Check Test Results
if: failure()
run: |
echo "Tests failed. Check logs above for details."
exit 1
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: test_reports/
retention-days: 30