From 64ceed6236cbd3f9169cf91914210c9e33b34839 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sat, 25 Oct 2025 16:04:31 +0200 Subject: [PATCH] Add Gitea Actions workflow for automated binary releases - Build cm-dashboard and cm-dashboard-agent binaries on tag push - Upload binaries as release assets via Gitea API - Use curl-based approach instead of external actions - Support manual workflow dispatch for testing --- .gitea/workflows/release.yml | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 1d55bb9..33724f4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -54,21 +54,40 @@ jobs: echo "VERSION=${GITEA_REF#refs/tags/}" >> $GITEA_OUTPUT fi - - name: Create Release - uses: gitea-actions/release-action@v1 + - name: Create Release with curl env: GITEA_TOKEN: ${{ secrets.GITEATOKEN }} - with: - tag_name: ${{ steps.version.outputs.VERSION }} - name: cm-dashboard ${{ steps.version.outputs.VERSION }} - body: | - ## cm-dashboard ${{ steps.version.outputs.VERSION }} - - Pre-built binaries for Linux x86_64: - - `cm-dashboard-linux-x86_64` - Dashboard TUI binary - - `cm-dashboard-agent-linux-x86_64` - Agent daemon binary - - `cm-dashboard-linux-x86_64.tar.gz` - Combined tarball - files: | - release/cm-dashboard-linux-x86_64 - release/cm-dashboard-agent-linux-x86_64 - release/cm-dashboard-linux-x86_64.tar.gz \ No newline at end of file + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + + # Create release + curl -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "'$VERSION'", + "name": "cm-dashboard '$VERSION'", + "body": "## cm-dashboard '$VERSION'\n\nPre-built binaries for Linux x86_64:\n- cm-dashboard-linux-x86_64 - Dashboard TUI binary\n- cm-dashboard-agent-linux-x86_64 - Agent daemon binary\n- cm-dashboard-linux-x86_64.tar.gz - Combined tarball" + }' \ + "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases" + + # Get release ID + RELEASE_ID=$(curl -s -H "Authorization: token $GITEA_TOKEN" \ + "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases/tags/$VERSION" | \ + grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) + + # Upload binaries + curl -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@release/cm-dashboard-linux-x86_64" \ + "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases/$RELEASE_ID/assets?name=cm-dashboard-linux-x86_64" + + curl -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@release/cm-dashboard-agent-linux-x86_64" \ + "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases/$RELEASE_ID/assets?name=cm-dashboard-agent-linux-x86_64" + + curl -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@release/cm-dashboard-linux-x86_64.tar.gz" \ + "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases/$RELEASE_ID/assets?name=cm-dashboard-linux-x86_64.tar.gz" \ No newline at end of file