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 echo "VERSION=${GITEA_REF#refs/tags/}" >> $GITEA_OUTPUT
fi fi
- name: Create Release - name: Create Release with curl
uses: gitea-actions/release-action@v1
env: env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }} GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
with: run: |
tag_name: ${{ steps.version.outputs.VERSION }} VERSION="${{ steps.version.outputs.VERSION }}"
name: cm-dashboard ${{ steps.version.outputs.VERSION }}
body: | # Create release
## cm-dashboard ${{ steps.version.outputs.VERSION }} curl -X POST \
-H "Authorization: token $GITEA_TOKEN" \
Pre-built binaries for Linux x86_64: -H "Content-Type: application/json" \
- `cm-dashboard-linux-x86_64` - Dashboard TUI binary -d '{
- `cm-dashboard-agent-linux-x86_64` - Agent daemon binary "tag_name": "'$VERSION'",
- `cm-dashboard-linux-x86_64.tar.gz` - Combined tarball "name": "cm-dashboard '$VERSION'",
files: | "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"
release/cm-dashboard-linux-x86_64 }' \
release/cm-dashboard-agent-linux-x86_64 "https://gitea.cmtec.se/api/v1/repos/cm/cm-dashboard/releases"
release/cm-dashboard-linux-x86_64.tar.gz
# 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"