name: Build and Upload Binaries on: push: tags: - 'v*' jobs: build: runs-on: ubuntu-latest timeout-minutes: 45 steps: - name: Checkout run: | mkdir -p ~/.ssh echo "${{ secrets.TEKTON_SSH_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -p 222 100.79.174.108 >> ~/.ssh/known_hosts git clone ssh://git@100.79.174.108:222/danchie/tekton.git . git checkout ${{ github.ref_name }} - name: Setup Godot run: | wget -q https://github.com/godotengine/godot-builds/releases/download/4.6-stable/Godot_v4.6-stable_linux.x86_64.zip unzip -q Godot_v4.6-stable_linux.x86_64.zip sudo mv Godot_v4.6-stable_linux.x86_64 /usr/local/bin/godot chmod +x /usr/local/bin/godot - name: Install export templates run: | mkdir -v -p ~/.local/share/godot/export_templates/4.6.stable wget -q https://github.com/godotengine/godot-builds/releases/download/4.6-stable/Godot_v4.6-stable_export_templates.tpz unzip -q Godot_v4.6-stable_export_templates.tpz -d ~/.local/share/godot/export_templates/4.6.stable - name: Build Windows run: mkdir -p build && godot --headless --export-release "Windows Desktop" build/tekton.exe - name: Build Linux run: godot --headless --export-release "Linux/X11" build/tekton.x86_64 - name: Get or create Gitea release id: gitea_release env: GITEA_TOKEN: ${{ secrets.TEKTON_RELEASE_TOKEN }} TAG_NAME: ${{ github.ref_name }} run: | API="https://git.klud.top/api/v1/repos/danchie/tekton/releases" RELEASE_JSON=$(curl -s -H "Authorization: token $GITEA_TOKEN" "$API/tags/$TAG_NAME") RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') if [ -z "$RELEASE_ID" ]; then RELEASE_JSON=$(curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\"}" \ "$API") RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') fi echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT" - name: Upload Windows Binary run: | curl -X POST \ -H "Authorization: token ${{ secrets.TEKTON_RELEASE_TOKEN }}" \ -H "Content-Type: multipart/form-data" \ -F "attachment=@build/tekton.exe" \ "https://git.klud.top/api/v1/repos/danchie/tekton/releases/${{ steps.gitea_release.outputs.release_id }}/assets" - name: Upload Linux Binary run: | curl -X POST \ -H "Authorization: token ${{ secrets.TEKTON_RELEASE_TOKEN }}" \ -H "Content-Type: multipart/form-data" \ -F "attachment=@build/tekton.x86_64" \ "https://git.klud.top/api/v1/repos/danchie/tekton/releases/${{ steps.gitea_release.outputs.release_id }}/assets"