From 30f4ebbd6dc310cd8390e7808c3950a927e8e251 Mon Sep 17 00:00:00 2001 From: Sam Geyskens Date: Tue, 23 Dec 2025 15:39:01 +0100 Subject: [PATCH] fix paths --- .gitea/workflows/build-release.yml | 64 +++++++++++++++++------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/build-release.yml b/.gitea/workflows/build-release.yml index cdfe0a1..677a76e 100644 --- a/.gitea/workflows/build-release.yml +++ b/.gitea/workflows/build-release.yml @@ -67,31 +67,39 @@ jobs: -o bin/${OUTPUT_NAME} ./cmd/safelineApi echo "BINARY_NAME=${OUTPUT_NAME}" >> $GITHUB_ENV - - name: Upload Release Asset - uses: gitea-github-actions/actions/gitea-release@main - with: - files: bin/${{ env.BINARY_NAME }} - draft: false - prerelease: false - allowUpdates: true - title: Release ${{ steps.version.outputs.VERSION }} - body: | - # SafelineAPI ${{ steps.version.outputs.VERSION }} - - ## Available Downloads - - ### Linux - - **amd64**: safelineApi-linux-amd64 - - **ARM64**: safelineApi-linux-arm64 - - **ARMv7**: safelineApi-linux-armv7 - - **386**: safelineApi-linux-386 - - **PowerPC 64LE**: safelineApi-linux-ppc64le - - ### Windows - - **amd64**: safelineApi-windows-amd64.exe - - **386**: safelineApi-windows-386.exe - - Built at: ${{ github.event.head_commit.timestamp }} - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - GITEA_SERVER: ${{ gitea.server_url }} + - name: Create or Update Release + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + REPO="${{ gitea.repository }}" + SERVER="${{ gitea.server_url }}" + TOKEN="${{ secrets.GITEA_TOKEN }}" + + # Try to create release (ignore error if already exists) + curl -X POST "${SERVER}/api/v1/repos/${REPO}/releases" \ + -H "Authorization: token ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "'${VERSION}'", + "target_commitish": "main", + "name": "Release '${VERSION}'", + "body": "# SafelineAPI '${VERSION}'\n\n## Available Downloads\n\n### Linux\n- **amd64**: safelineApi-linux-amd64\n- **ARM64**: safelineApi-linux-arm64\n- **ARMv7**: safelineApi-linux-armv7\n- **386**: safelineApi-linux-386\n- **PowerPC 64LE**: safelineApi-linux-ppc64le\n\n### Windows\n- **amd64**: safelineApi-windows-amd64.exe\n- **386**: safelineApi-windows-386.exe", + "draft": false, + "prerelease": false + }' || true + + - name: Upload Binary Asset + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + REPO="${{ gitea.repository }}" + SERVER="${{ gitea.server_url }}" + TOKEN="${{ secrets.GITEA_TOKEN }}" + BINARY="${{ env.BINARY_NAME }}" + + # Get release ID + RELEASE_ID=$(curl -s "${SERVER}/api/v1/repos/${REPO}/releases/tags/${VERSION}" \ + -H "Authorization: token ${TOKEN}" | grep '"id"' | head -1 | grep -o '[0-9]*') + + # Upload the binary + curl -X POST "${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \ + -H "Authorization: token ${TOKEN}" \ + -F "attachment=@bin/${BINARY}" || true