Add Gitea Actions workflow for automated binary releases

Create workflow to build and release pre-built binaries:
- Triggers on git tags (v*) or manual dispatch
- Builds cm-dashboard and cm-dashboard-agent for Linux x86_64
- Creates Gitea release with attached binary files
- Provides tarball for easy distribution

This enables switching from source builds to pre-built binaries
in NixOS configuration for faster rebuilds.
This commit is contained in:
Christoffer Martinsson 2025-10-25 15:51:23 +02:00
parent 1b3f8671c0
commit 43196af70c

View File

@ -0,0 +1,72 @@
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v0.1.0)'
required: true
default: 'v0.1.0'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev libzmq3-dev
- name: Build workspace
run: |
cargo build --release --workspace
- name: Create release directory
run: |
mkdir -p release
cp target/release/cm-dashboard release/cm-dashboard-linux-x86_64
cp target/release/cm-dashboard-agent release/cm-dashboard-agent-linux-x86_64
- name: Create tarball
run: |
cd release
tar -czf cm-dashboard-linux-x86_64.tar.gz cm-dashboard-linux-x86_64 cm-dashboard-agent-linux-x86_64
- name: Set version variable
id: version
run: |
if [ "${{ gitea.event_name }}" == "workflow_dispatch" ]; then
echo "VERSION=${{ gitea.event.inputs.version }}" >> $GITEA_OUTPUT
else
echo "VERSION=${GITEA_REF#refs/tags/}" >> $GITEA_OUTPUT
fi
- name: Create Release
uses: gitea-actions/release-action@v1
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