From bf4cb1830ef4220e582ff7df6dd27b7009fb8e26 Mon Sep 17 00:00:00 2001 From: Olof Pettersson Date: Tue, 2 Dec 2025 23:54:44 +0100 Subject: [PATCH] Better publish script --- .gitea/workflows/build-engine.yaml | 46 +++++----------------------- .gitea/workflows/scripts/publish.sh | 47 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 .gitea/workflows/scripts/publish.sh diff --git a/.gitea/workflows/build-engine.yaml b/.gitea/workflows/build-engine.yaml index 2d62f2b80f1..5149746ef96 100644 --- a/.gitea/workflows/build-engine.yaml +++ b/.gitea/workflows/build-engine.yaml @@ -58,53 +58,23 @@ jobs: # --- JOB 2: PUBLISH (Serial) --- publish: - # Only run if all builds succeed needs: build-windows runs-on: ubuntu-latest steps: - # 1. Download ALL artifacts from the matrix jobs - name: Download All Artifacts uses: actions/download-artifact@v3 with: path: dist - - name: Organize and Publish + - name: Package and Publish + uses: docker://alpine:latest env: + # Pass config & secrets API_URL: https://gitea.212.63.210.91.nip.io/api/packages/${{ gitea.repository_owner }}/generic TOKEN: ${{ secrets.USER_PACKAGE_PASSWORD }} + ACTOR: ${{ gitea.actor }} VERSION: ${{ gitea.sha }} - run: | - echo "Organizing artifacts..." - ls -R dist/ - - # Structure after download will look like: - # dist/godot-windows-editor/godot.windows.editor...exe - # dist/godot-windows-debug/godot.windows.template_debug...exe - - # --- 1. PUBLISH EDITOR --- - echo "Publishing Editor..." - # Find the editor exe (using wildcard to be safe) - EDITOR_EXE=$(find dist/godot-windows-editor -name "*.exe") - - curl --fail --user "${{ gitea.actor }}:$TOKEN" \ - --upload-file "$EDITOR_EXE" \ - "$API_URL/godot-editor-windows/$VERSION/godot-editor.exe" - - # --- 2. PACKAGE TEMPLATES --- - echo "Zipping Templates..." - mkdir -p templates - - # Copy debug and release templates to a single folder - # We rename them to simple names for the zip - cp dist/godot-windows-debug/*.exe templates/windows_debug_x86_64.exe - cp dist/godot-windows-release/*.exe templates/windows_release_x86_64.exe - - # Zip them up - zip -j templates.tpz templates/* - - echo "Publishing Templates..." - curl --fail --user "${{ gitea.actor }}:$TOKEN" \ - --upload-file "templates.tpz" \ - "$API_URL/godot-templates/$VERSION/windows_templates.tpz" - - echo "✅ All packages published!" \ No newline at end of file + with: + entrypoint: /bin/sh + # The workspace (containing 'dist' and 'scripts') is automatically mounted + args: .gitea/workflows/scripts/publish.sh \ No newline at end of file diff --git a/.gitea/workflows/scripts/publish.sh b/.gitea/workflows/scripts/publish.sh new file mode 100644 index 00000000000..f4f58adb5ca --- /dev/null +++ b/.gitea/workflows/scripts/publish.sh @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +# --- 0. SETUP --- +# We install dependencies because we are running in a minimal Alpine container +echo "Installing tools..." +apk add --no-cache curl zip + +echo "------------------------------------------------" +echo "Publishing Packages for: $VERSION" +echo "Registry API: $API_URL" +echo "------------------------------------------------" + +# --- 1. PUBLISH EDITOR --- +echo "Processing Editor..." +# Zip both .exe and .console.exe +zip -j godot-editor-windows.zip dist/godot-windows-editor/*.exe + +echo "Uploading Editor..." +curl --fail --user "$ACTOR:$TOKEN" \ + --upload-file "godot-editor-windows.zip" \ + "$API_URL/godot-editor-windows/$VERSION/godot-editor-windows.zip" + +# --- 2. PUBLISH TEMPLATES --- +echo "Processing Templates..." +mkdir -p templates + +# Select specific binaries (ignoring console wrapper) +DEBUG_SRC=$(find dist/godot-windows-debug -name "*.exe" | grep -v "console.exe" | head -n 1) +RELEASE_SRC=$(find dist/godot-windows-release -name "*.exe" | grep -v "console.exe" | head -n 1) + +echo "Found Debug: $DEBUG_SRC" +echo "Found Release: $RELEASE_SRC" + +# Rename to standard Godot export names +cp "$DEBUG_SRC" templates/windows_debug_x86_64.exe +cp "$RELEASE_SRC" templates/windows_release_x86_64.exe + +# Zip into TPZ +zip -j templates.tpz templates/* + +echo "Uploading Templates..." +curl --fail --user "$ACTOR:$TOKEN" \ + --upload-file "templates.tpz" \ + "$API_URL/godot-templates/$VERSION/windows_templates.tpz" + +echo "✅ Success! All packages published." \ No newline at end of file