From 00d4b224eb8ac0615f59e966ef53ca68c5f53e9f Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 10 Feb 2026 15:28:41 -0500 Subject: [PATCH] fix: add GitHub release creation to workflow Gitea's push mirroring syncs git objects (branches, tags, commits) but does not sync GitHub release objects or assets. Since ArtifactHub needs to download the plugin tarball from the GitHub release URL, the workflow must create releases on both Gitea and GitHub. Changes: - Added "Create GitHub release" step after Gitea release - Uses GITHUB_TOKEN secret for GitHub API authentication - Creates release and uploads tarball to GitHub - Mirroring still handles git data sync Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .gitea/workflows/release.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 582c628..ef2375c 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -111,6 +111,36 @@ jobs: "${API_URL}/releases/${RELEASE_ID}/assets?name=${TARBALL}" echo "Gitea release updated" + - name: Create GitHub release + run: | + [ "$SKIP_BUILD" = "true" ] && exit 0 + # GitHub API to create/update release + GITHUB_API="https://api.github.com/repos/cpfarhood/headlamp-polaris-plugin" + # Check if release exists + RELEASE_DATA=$(curl -sf \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "${GITHUB_API}/releases/tags/${GITHUB_REF_NAME}" || echo "{}") + RELEASE_ID=$(echo "$RELEASE_DATA" | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>console.log(JSON.parse(d).id||''))") + + if [ -z "$RELEASE_ID" ]; then + # Create new release + RELEASE_DATA=$(curl -sf -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + "${GITHUB_API}/releases" \ + -d "{\"tag_name\":\"${GITHUB_REF_NAME}\",\"name\":\"${GITHUB_REF_NAME}\",\"draft\":false,\"prerelease\":false}") + RELEASE_ID=$(echo "$RELEASE_DATA" | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>console.log(JSON.parse(d).id))") + fi + + echo "GitHub Release ID: $RELEASE_ID" + # Upload tarball to GitHub + UPLOAD_URL=$(echo "$RELEASE_DATA" | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const r=JSON.parse(d);console.log(r.upload_url||'https://uploads.github.com/repos/cpfarhood/headlamp-polaris-plugin/releases/${RELEASE_ID}/assets')})" | sed 's/{.*}//') + curl -sf -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/gzip" \ + --data-binary "@${TARBALL}" \ + "${UPLOAD_URL}?name=${TARBALL}" + echo "GitHub release updated" - name: Update metadata and align tag run: |