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
This commit is contained in:
Christoffer Martinsson 2025-10-25 16:04:31 +02:00
parent 09dcd53da5
commit 64ceed6236

View File

@ -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
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"