From a7d0645d277ff6c30a01779a2ab8e81a4e43cb1b Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 20 Dec 2025 12:41:24 -0500 Subject: [PATCH] Holy shit this might have worked --- .../{debug-api.yml => debug-api.yml.disabled} | 0 .../{release.yml.disabled => release.yml} | 35 ++++++------------- 2 files changed, 11 insertions(+), 24 deletions(-) rename .forgejo/workflows/{debug-api.yml => debug-api.yml.disabled} (100%) rename .forgejo/workflows/{release.yml.disabled => release.yml} (58%) diff --git a/.forgejo/workflows/debug-api.yml b/.forgejo/workflows/debug-api.yml.disabled similarity index 100% rename from .forgejo/workflows/debug-api.yml rename to .forgejo/workflows/debug-api.yml.disabled diff --git a/.forgejo/workflows/release.yml.disabled b/.forgejo/workflows/release.yml similarity index 58% rename from .forgejo/workflows/release.yml.disabled rename to .forgejo/workflows/release.yml index 7edfa93..cda02ee 100644 --- a/.forgejo/workflows/release.yml.disabled +++ b/.forgejo/workflows/release.yml @@ -1,16 +1,9 @@ name: release on: - release: - types: [published] push: tags: - '*' - workflow_dispatch: - inputs: - tag: - description: 'Tag name for release (creates tag at HEAD)' - required: true jobs: build: @@ -46,35 +39,29 @@ jobs: env: FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} run: | - echo "Token present: ${FORGEJO_TOKEN:+yes}" - echo "Token length: ${#FORGEJO_TOKEN}" - - TAG="${{ github.event.inputs.tag || github.ref_name }}" + TAG="${{ github.ref_name }}" API_BASE="${{ github.server_url }}/api/v1" REPO="${{ github.repository }}" - echo "Looking for release: ${API_BASE}/repos/${REPO}/releases/tags/${TAG}" - RESPONSE=$(wget -qO- --header="Authorization: token ${FORGEJO_TOKEN}" \ - "${API_BASE}/repos/${REPO}/releases/tags/${TAG}" 2>/dev/null || echo '{}') - echo "Lookup response: ${RESPONSE}" - RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id // empty') + # check if release exists + RELEASE_ID=$(curl -sf \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + "${API_BASE}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id // empty') if [ -z "$RELEASE_ID" ]; then echo "Creating release for ${TAG}..." - RESPONSE=$(wget -qO- --header="Authorization: token ${FORGEJO_TOKEN}" \ - --header="Content-Type: application/json" \ - --post-data='{"tag_name": "'"${TAG}"'", "name": "'"${TAG}"'"}' \ - "${API_BASE}/repos/${REPO}/releases" 2>&1) - echo "Create response: ${RESPONSE}" - RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id') + RELEASE_ID=$(curl -sf \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"tag_name":"'"${TAG}"'","name":"'"${TAG}"'"}' \ + "${API_BASE}/repos/${REPO}/releases" | jq -r '.id') fi echo "Release ID: ${RELEASE_ID}" - # upload assets (still need curl for multipart) for file in lofivor-linux-x86_64 lofivor-windows-x86_64.exe; do echo "Uploading $file..." - curl -sf -X POST \ + curl -sf \ -H "Authorization: token ${FORGEJO_TOKEN}" \ -F "attachment=@${file}" \ "${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${file}"