From 3923e2e4b9004fa4f30002924cd8133d691c1215 Mon Sep 17 00:00:00 2001 From: forbes Date: Fri, 6 Feb 2026 18:22:23 -0600 Subject: [PATCH] fix(ci): replace release-action with direct Gitea API calls The gitea.com/actions/release-action is archived and requires go to build from source, which isn't available in the ubuntu-latest runner. Replace with curl calls to the Gitea release API: create release, upload assets. Handles existing releases by deleting and recreating. --- .gitea/workflows/release.yml | 74 ++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index f8a8232cdd..362740dcde 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -315,22 +315,66 @@ jobs: ls -lah release/ - name: Create release - uses: https://gitea.com/actions/release-action@main - with: - files: release/* - title: "Kindred Create ${{ env.BUILD_TAG }}" - body: | - ## Kindred Create ${{ env.BUILD_TAG }} + env: + GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITEA_URL: ${{ github.server_url }} + REPO: ${{ github.repository }} + run: | + TAG="${BUILD_TAG}" + PRERELEASE=false + if echo "$TAG" | grep -qE '(rc|beta|alpha)'; then + PRERELEASE=true + fi - ### Downloads + BODY="## Kindred Create ${TAG} - | Platform | File | - |----------|------| - | Linux (AppImage) | `KindredCreate-*-Linux-x86_64.AppImage` | - | Linux (Debian/Ubuntu) | `kindred-create_*.deb` | + ### Downloads - *macOS and Windows builds are not yet available.* + | Platform | File | + |----------|------| + | Linux (AppImage) | \`KindredCreate-*-Linux-x86_64.AppImage\` | + | Linux (Debian/Ubuntu) | \`kindred-create_*.deb\` | - SHA256 checksums are provided alongside each artifact. - prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }} - api_key: ${{ secrets.RELEASE_TOKEN }} + *macOS and Windows builds are not yet available.* + + SHA256 checksums are provided alongside each artifact." + + # Delete existing release for this tag (if any) so we can recreate + existing=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG}") + if [ "$existing" = "200" ]; then + release_id=$(curl -s \ + -H "Authorization: token ${GITEA_TOKEN}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG}" | \ + python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + curl -s -X DELETE \ + -H "Authorization: token ${GITEA_TOKEN}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/${release_id}" + echo "Deleted existing release ${release_id} for tag ${TAG}" + fi + + # Create release + release_id=$(curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "$(python3 -c "import json; print(json.dumps({ + 'tag_name': '${TAG}', + 'name': 'Kindred Create ${TAG}', + 'body': '''${BODY}''', + 'prerelease': ${PRERELEASE} + }))")" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases" | \ + python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + echo "Created release ${release_id}" + + # Upload assets + for file in release/*; do + filename=$(basename "$file") + echo "Uploading ${filename}..." + curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -F "attachment=@${file}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/${release_id}/assets?name=${filename}" + echo " done." + done