From 5fa079664f545c997533a6b8ada451f9bf33010f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Tue, 10 Mar 2026 14:12:51 +0100 Subject: [PATCH] replace github-specific release action with gitea api calls Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/build.yml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index fcd7571..f45ce3a 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -22,9 +22,26 @@ jobs: VERSION=$(grep -A1 'version' info.plist | grep '' | sed 's/.*//;s/<\/string>.*//') echo "version=${VERSION}" >> "$GITHUB_OUTPUT" - - name: Create release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ steps.version.outputs.version }} - name: v${{ steps.version.outputs.version }} - files: dist/tmux-cheat-sheet.alfredworkflow + - name: Create release and upload artifact + env: + VERSION: v${{ steps.version.outputs.version }} + run: | + API="${GITHUB_SERVER_URL}/api/v1" + REPO="${GITHUB_REPOSITORY}" + AUTH="Authorization: token ${GITHUB_TOKEN}" + + # delete existing release for this tag (idempotent) + EXISTING=$(curl -sf -H "$AUTH" "$API/repos/$REPO/releases/tags/$VERSION" | jq -r '.id // empty') || true + if [ -n "$EXISTING" ]; then + curl -sf -X DELETE -H "$AUTH" "$API/repos/$REPO/releases/$EXISTING" + fi + + # create release + RELEASE_ID=$(curl -sf -X POST -H "$AUTH" -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$VERSION\",\"name\":\"$VERSION\",\"body\":\"Automated build from main\"}" \ + "$API/repos/$REPO/releases" | jq -r '.id') + + # upload artifact + curl -sf -X POST -H "$AUTH" \ + -F "attachment=@dist/tmux-cheat-sheet.alfredworkflow" \ + "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=tmux-cheat-sheet.alfredworkflow"