From ab0ff3f28da16d39a36c8ce2fe57281b13815e34 Mon Sep 17 00:00:00 2001 From: Alexander Renz Date: Wed, 7 Jan 2026 12:10:33 +0100 Subject: [PATCH] ci: add release job with Gitea binary uploads - Upload artifacts on tag pushes - Create release via Gitea API - Attach all platform binaries to release --- .gitea/workflows/ci.yml | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 68f6cfa..5f85ef0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -94,3 +94,51 @@ jobs: run: | go build -ldflags="-s -w" -o dbbackup-${GOOS}-${GOARCH} . ls -lh dbbackup-* + + - name: Upload artifact + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v3 + with: + name: dbbackup-${{ matrix.goos }}-${{ matrix.goarch }} + path: dbbackup-${{ matrix.goos }}-${{ matrix.goarch }} + + release: + name: Release + runs-on: ubuntu-latest + needs: [build] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Prepare release files + run: | + mkdir -p release + find artifacts -type f -name 'dbbackup-*' -exec cp {} release/ \; + cd release && ls -lh + + - name: Create Gitea Release + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + TAG=${GITHUB_REF#refs/tags/} + + # Create release via API + RELEASE_ID=$(curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG} - Systemd Integration & Prometheus Metrics\",\"body\":\"## Download\\n\\nSelect the binary for your platform.\",\"draft\":false,\"prerelease\":false}" \ + "https://git.uuxo.net/api/v1/repos/${GITHUB_REPOSITORY}/releases" | jq -r '.id') + + echo "Created release ID: $RELEASE_ID" + + # Upload each binary + for file in release/dbbackup-*; do + echo "Uploading $file..." + curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -F "attachment=@${file}" \ + "https://git.uuxo.net/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" + done \ No newline at end of file