name: Release on: push: tags: - 'v*' jobs: release: name: Build & Release runs-on: ubuntu-latest timeout-minutes: 30 env: GITEA_TOKEN: ${{ secrets.TEKTON_RELEASE_TOKEN }} TAG_NAME: ${{ github.ref_name }} steps: - name: Setup SSH uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.TEKTON_SSH_KEY }} - name: Install tools run: apt-get update -qq && apt-get install -y -qq curl unzip - name: Add Gitea SSH Host Key run: | mkdir -p ~/.ssh ssh-keyscan -p 22 172.18.0.2 >> ~/.ssh/known_hosts || true # Route all possible hostnames Gitea might hand out via API back to the internal docker port 22 printf "Host gitea\n HostName 172.18.0.2\n Port 22\n StrictHostKeyChecking no\n" > ~/.ssh/config printf "Host thunderobot\n HostName 172.18.0.2\n Port 22\n StrictHostKeyChecking no\n" >> ~/.ssh/config printf "Host thunderobot.tail5d6e8e.ts.net\n HostName 172.18.0.2\n Port 22\n StrictHostKeyChecking no\n" >> ~/.ssh/config # Force checkout to rewrite port 222 down to 22 git config --global url."ssh://git@gitea/".insteadOf "ssh://git@gitea:222/" git config --global url."ssh://git@gitea/".insteadOf "git@gitea:222:" git config --global url."ssh://git@thunderobot.tail5d6e8e.ts.net/".insteadOf "ssh://git@thunderobot.tail5d6e8e.ts.net:222/" git config --global url."ssh://git@thunderobot.tail5d6e8e.ts.net/".insteadOf "git@thunderobot.tail5d6e8e.ts.net:222:" git config --global url."ssh://git@thunderobot/".insteadOf "ssh://git@thunderobot:222/" git config --global url."ssh://git@thunderobot/".insteadOf "git@thunderobot:222:" chmod 600 ~/.ssh/config - name: Checkout Code uses: actions/checkout@v4 with: repository: danchie/tekton ssh-key: ${{ secrets.TEKTON_SSH_KEY }} - name: Setup Godot (Cached) run: | apt-get install -y zip # Use cached godot engine binary if [ ! -f /cache/godot_4.6 ]; then echo "Downloading Godot 4.6..." curl -sL -o /tmp/godot.zip "https://github.com/godotengine/godot-builds/releases/download/4.6-stable/Godot_v4.6-stable_linux.x86_64.zip" unzip -q -o /tmp/godot.zip -d /cache/ mv /cache/Godot_v4.6-stable_linux.x86_64 /cache/godot_4.6 fi cp /cache/godot_4.6 /usr/local/bin/godot chmod +x /usr/local/bin/godot # Setup templates mkdir -p ~/.local/share/godot/export_templates/4.6.stable.official if [ ! -f /cache/Godot_v4.6-stable_export_templates.tpz ]; then echo "Downloading templates..." curl -sL -o /cache/Godot_v4.6-stable_export_templates.tpz \ "https://github.com/godotengine/godot-builds/releases/download/4.6-stable/Godot_v4.6-stable_export_templates.tpz" fi cd ~/.local/share/godot/export_templates/4.6.stable.official unzip -q -o /cache/Godot_v4.6-stable_export_templates.tpz mv templates/* . rm -rf templates cd $GITHUB_WORKSPACE mkdir -p build - name: Export Windows run: | mkdir -p build/windows cp addons/godotsteam/libgodotsteam* build/windows/ 2>/dev/null || true godot --headless --export-release "Windows Desktop" build/windows/tekton_armageddon_windows.exe || true cd build/windows && zip -r ../tekton_armageddon_windows_${TAG_NAME}.zip . - name: Export Linux run: | mkdir -p build/linux godot --headless --export-release "Linux/X11" build/linux/tekton_armageddon_linux.x86_64 || true cd build/linux && zip -r ../tekton_armageddon_linux_${TAG_NAME}.zip . - name: Export macOS run: | mkdir -p build/macos godot --headless --export-release "macOS" build/macos/tekton_armageddon_macos.zip 2>&1 | tail -5 mv build/macos/tekton_armageddon_macos.zip build/tekton_armageddon_macos_${TAG_NAME}.zip - name: Create Gitea Release run: | set -e API="http://gitea:3000/api/v1/repos/danchie/tekton/releases" TAG="$TAG_NAME" echo "Checking existing release for $TAG..." RELEASE_JSON=$(curl -s -H "Authorization: token $GITEA_TOKEN" "$API/tags/$TAG") RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*' || true) if [ -z "$RELEASE_ID" ]; then echo "Creating new release for $TAG..." RELEASE_JSON=$(curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":true}" \ "$API") echo "API response: $RELEASE_JSON" RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') if [ -z "$RELEASE_ID" ]; then echo "FATAL: Could not create release" exit 1 fi fi echo "release_id=$RELEASE_ID" echo "$RELEASE_ID" > /tmp/release_id.txt - name: Upload Windows asset run: | RELEASE_ID=$(cat /tmp/release_id.txt) curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: multipart/form-data" \ -F "attachment=@build/tekton_armageddon_windows_${TAG_NAME}.zip" \ "http://gitea:3000/api/v1/repos/danchie/tekton/releases/$RELEASE_ID/assets" echo "Windows uploaded" - name: Upload Linux asset run: | RELEASE_ID=$(cat /tmp/release_id.txt) curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: multipart/form-data" \ -F "attachment=@build/tekton_armageddon_linux_${TAG_NAME}.zip" \ "http://gitea:3000/api/v1/repos/danchie/tekton/releases/$RELEASE_ID/assets" echo "Linux uploaded" - name: Upload macOS asset run: | RELEASE_ID=$(cat /tmp/release_id.txt) curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: multipart/form-data" \ -F "attachment=@build/tekton_armageddon_macos_${TAG_NAME}.zip" \ "http://gitea:3000/api/v1/repos/danchie/tekton/releases/$RELEASE_ID/assets" echo "macOS uploaded" - name: Publish release run: | RELEASE_ID=$(cat /tmp/release_id.txt) curl -s -X PATCH \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"draft":false}' \ "http://gitea:3000/api/v1/repos/danchie/tekton/releases/$RELEASE_ID" echo "Published: https://git.klud.top/danchie/tekton/releases/tag/$TAG_NAME"