125 lines
3.9 KiB
YAML
125 lines
3.9 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Release version (e.g., v1.0.0)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://git.quad4.io/actions/checkout@a5b3063b1edaa6ba4911c8a1b1d5e1656fba3ea5 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Determine version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Download frontend from CI
|
|
id: download-frontend
|
|
continue-on-error: true
|
|
uses: https://git.quad4.io/actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
|
with:
|
|
name: frontend-build
|
|
path: build/
|
|
github-token: ${{ secrets.GITEA_TOKEN }}
|
|
workflow: ci.yml
|
|
commit: ${{ github.sha }}
|
|
|
|
- name: Setup Node.js for frontend build
|
|
if: steps.download-frontend.outcome == 'failure'
|
|
uses: https://git.quad4.io/actions/setup-node@f024d6d0d28a7923957f5e6ea99ca485084e5c58 # v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Setup Task for frontend
|
|
if: steps.download-frontend.outcome == 'failure'
|
|
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
|
with:
|
|
version: '3.46.3'
|
|
|
|
- name: Build frontend if not downloaded
|
|
if: steps.download-frontend.outcome == 'failure'
|
|
run: |
|
|
task setup
|
|
task install:ci
|
|
task build:frontend
|
|
|
|
- name: Setup Go
|
|
uses: https://git.quad4.io/actions/setup-go@f50900cd786a0c549eed5a472b4f2c371ae8589f # v5
|
|
with:
|
|
go-version: '1.25.5'
|
|
|
|
- name: Setup Task
|
|
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
|
with:
|
|
version: '3.46.3'
|
|
|
|
- name: Build server binaries
|
|
run: |
|
|
task build:backend
|
|
task build-linux-amd64
|
|
task build-windows-amd64
|
|
|
|
- name: Build desktop Linux
|
|
run: task desktop-linux
|
|
|
|
- name: Build desktop Windows
|
|
run: task desktop-windows
|
|
|
|
- name: Prepare release assets
|
|
run: |
|
|
mkdir -p release-assets
|
|
cp bin/linking-tool-linux-amd64 release-assets/
|
|
cp bin/linking-tool-windows-amd64.exe release-assets/
|
|
if [ -f desktop/build/bin/linking-tool ]; then
|
|
cp desktop/build/bin/linking-tool release-assets/linking-tool-desktop-linux-amd64
|
|
fi
|
|
if [ -f desktop/build/bin/linking-tool.exe ]; then
|
|
cp desktop/build/bin/linking-tool.exe release-assets/linking-tool-desktop-windows-amd64.exe
|
|
fi
|
|
|
|
- name: Download SBOM
|
|
run: |
|
|
git fetch origin master:master || true
|
|
git checkout master -- sbom/ || git checkout ${{ github.sha }} -- sbom/ || true
|
|
if [ -d sbom ]; then
|
|
cp sbom/*.json release-assets/ || true
|
|
fi
|
|
|
|
- name: Create Release
|
|
uses: https://git.quad4.io/actions/gitea-release-action@4875285c0950474efb7ca2df55233c51333eeb74 # v1
|
|
with:
|
|
api_url: ${{ secrets.GITEA_API_URL }}
|
|
gitea_token: ${{ secrets.GITEA_TOKEN }}
|
|
title: ${{ steps.version.outputs.version }}
|
|
tag: ${{ steps.version.outputs.version }}
|
|
body: |
|
|
Release ${{ steps.version.outputs.version }}
|
|
|
|
## Assets
|
|
- Server binaries (Linux AMD64, Windows AMD64)
|
|
- Desktop applications (Linux AMD64, Windows AMD64)
|
|
- SBOM files
|
|
files: release-assets/*
|
|
draft: false
|
|
prerelease: false
|
|
|