From f99bd7e7b2f50e8971a88be131d69540b337507b Mon Sep 17 00:00:00 2001 From: Dusk <24+dusk@noreply.octowow.st> Date: Sat, 12 Sep 2026 13:35:38 +0000 Subject: [PATCH] Actualiser .github/workflows/build.yml --- .github/workflows/build.yml | 88 +++++++++++-------------------------- 1 file changed, 26 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e7b109..b627ad3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,25 +12,31 @@ on: - 'main' workflow_dispatch: -permissions: - contents: write concurrency: - group: modernization-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} + group: modernization-${{ forgejo.workflow }}-${{ forgejo.event_name }}-${{ forgejo.ref }} cancel-in-progress: true jobs: build: - runs-on: windows-2025 + runs-on: windows-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: https://code.forgejo.org/actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11.9' + # Self-hosted Windows runner: use the Python already installed on the host. + # actions/setup-python tries to modify machine-wide registry keys and needs + # elevated rights on this runner. + - name: Verify runner Python + shell: powershell + run: | + $version = python -c "import platform; print(platform.python_version())" + if ($LASTEXITCODE -ne 0) { throw "Python is not available on the runner PATH." } + Write-Host "Runner Python: $version" + if ($version -ne "3.12.10") { + throw "Expected Python 3.12.10 on the self-hosted runner, found $version." + } - name: Install pinned build toolchain run: python -m pip install --disable-pip-version-check -r requirements-build.txt @@ -43,14 +49,8 @@ jobs: # Direct pushes to test/** run validation only. PRs, main, tags and # explicit manual runs still validate a real Windows build. - - name: Configure x86 MSVC - if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x86 - - name: Prepare bundled remote fallbacks - if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} + if: ${{ forgejo.event_name != 'push' || forgejo.ref == 'refs/heads/main' || startsWith(forgejo.ref, 'refs/tags/v') }} run: python scripts/prepare_remote_fallbacks.py - name: Syntax check @@ -60,7 +60,7 @@ jobs: run: python -m unittest discover -s tests -v - name: Build EXE - if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} + if: ${{ forgejo.event_name != 'push' || forgejo.ref == 'refs/heads/main' || startsWith(forgejo.ref, 'refs/tags/v') }} run: > pyinstaller --noconsole @@ -73,15 +73,15 @@ jobs: setup_tool_responsive.py - name: Verify EXE exists - if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} - shell: pwsh + if: ${{ forgejo.event_name != 'push' || forgejo.ref == 'refs/heads/main' || startsWith(forgejo.ref, 'refs/tags/v') }} + shell: powershell run: | if (-not (Test-Path "dist/WoW_Modernization_Tool.exe")) { throw "Build output missing" } Get-Item "dist/WoW_Modernization_Tool.exe" | Format-List Name,Length,LastWriteTime - name: Create ZIP package - if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} - shell: pwsh + if: ${{ forgejo.event_name != 'push' || forgejo.ref == 'refs/heads/main' || startsWith(forgejo.ref, 'refs/tags/v') }} + shell: powershell run: | $zip = "dist/WoW_Modernization_Tool.zip" if (Test-Path $zip) { Remove-Item $zip -Force } @@ -89,11 +89,11 @@ jobs: if (-not (Test-Path $zip)) { throw "ZIP package missing" } Get-Item $zip | Format-List Name,Length,LastWriteTime - # Ephemeral Actions artifacts are created only when explicitly requested. - # Release tags publish their EXE/ZIP directly as GitHub Release assets. - - name: Upload manual test artifact - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/upload-artifact@v4 + # Keep the finished EXE/ZIP available for manual release publishing. + # Artifacts are uploaded for explicit manual runs and version tags. + - name: Upload build artifact + if: ${{ forgejo.event_name == 'workflow_dispatch' || startsWith(forgejo.ref, 'refs/tags/v') }} + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: name: WoW_Modernization_Tool-test path: | @@ -101,39 +101,3 @@ jobs: dist/WoW_Modernization_Tool.zip if-no-files-found: error retention-days: 7 - - # One-time production promotion for v2.3. The exact commit message keeps - # normal main pushes from publishing or modifying the v2.3 release. - # Keep the Git tag aligned with the exact commit used to build the assets. - - name: Synchronize Git tag v2.3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.3' }} - shell: pwsh - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -f v2.3 "${{ github.sha }}" - git push origin refs/tags/v2.3 --force - - - name: Create GitHub Release v2.3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.3' }} - uses: softprops/action-gh-release@v3 - with: - tag_name: v2.3 - target_commitish: ${{ github.sha }} - files: | - dist/WoW_Modernization_Tool.exe - dist/WoW_Modernization_Tool.zip - fail_on_unmatched_files: true - overwrite_files: true - name: "WoW Modernization Tool v2.3" - body_path: RELEASE_NOTES.md - generate_release_notes: false - make_latest: true - - - name: Create GitHub Release - if: ${{ startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/tags/v2.3' }} - uses: softprops/action-gh-release@v3 - with: - files: | - dist/WoW_Modernization_Tool.exe - dist/WoW_Modernization_Tool.zip