Files
BetterDesk/.github/workflows/release-server.yml
T
UNITRONIX feb3d19987 chore: update .gitignore and Gitleaks configuration, enhance CI workflows
- Updated .gitignore to include new binary paths and retain .gitkeep.
- Modified Gitleaks configuration to ignore additional directories.
- Adjusted CI workflows to prevent execution on version bump pushes and improved version bump handling in scripts.
- Bumped BetterDesk Console Manager version to 3.3.136 in betterdesk.sh and related scripts.
2026-07-13 17:34:41 +02:00

128 lines
4.0 KiB
YAML

# =============================================================================
# BetterDesk Go Server — Cross-Compile & Release
# =============================================================================
# Builds Go server binary for Linux (amd64, arm64) and Windows (amd64).
# Triggers on version tag push (v*) or manual dispatch.
# Attaches binaries + SHA256 checksums to GitHub Release.
# =============================================================================
name: Build & Release Go Server
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v3.0.0)'
required: false
default: ''
type: string
permissions:
contents: write
env:
SERVER_DIR: betterdesk-server
jobs:
build:
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: linux-amd64
- goos: linux
goarch: arm64
suffix: linux-arm64
- goos: windows
goarch: amd64
suffix: windows-amd64.exe
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.SERVER_DIR }}/go.mod
cache-dependency-path: ${{ env.SERVER_DIR }}/go.sum
- name: Install Protobuf Compiler
run: sudo apt-get install -y protobuf-compiler
- name: Build binary
working-directory: ${{ env.SERVER_DIR }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
VERSION="${GITHUB_REF_NAME#v}"
go build -trimpath -ldflags="-s -w -X main.Version=${VERSION}" \
-o "betterdesk-server-${{ matrix.suffix }}" .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: betterdesk-server-${{ matrix.suffix }}
path: ${{ env.SERVER_DIR }}/betterdesk-server-${{ matrix.suffix }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# Migration tool
# ---------------------------------------------------------------------------
build-migrate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.SERVER_DIR }}/go.mod
cache-dependency-path: ${{ env.SERVER_DIR }}/go.sum
- name: Build migration tool (linux-amd64)
working-directory: ${{ env.SERVER_DIR }}/tools/migrate
env:
CGO_ENABLED: 1
run: go build -trimpath -ldflags="-s -w" -o migrate-linux-amd64 .
- name: Upload migration tool
uses: actions/upload-artifact@v4
with:
name: migrate-linux-amd64
path: ${{ env.SERVER_DIR }}/tools/migrate/migrate-linux-amd64
# ---------------------------------------------------------------------------
# Release
# ---------------------------------------------------------------------------
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, build-migrate]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Generate checksums
run: |
find . -type f \( -name "betterdesk-server-*" -o -name "migrate-*" \) | while read -r f; do
sha256sum "$f" >> SERVER_CHECKSUMS.sha256
done
cat SERVER_CHECKSUMS.sha256
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
betterdesk-server-linux-amd64/betterdesk-server-linux-amd64
betterdesk-server-linux-arm64/betterdesk-server-linux-arm64
betterdesk-server-windows-amd64.exe/betterdesk-server-windows-amd64.exe
migrate-linux-amd64/migrate-linux-amd64
SERVER_CHECKSUMS.sha256