AqualinkD/.github/workflows/build.yml

86 lines
3.1 KiB
YAML

name: AqualinkD build Workflow
on:
# push:
# branches: [ main ]
# tags:
# - 'v*.*.*'
workflow_dispatch: # Allow manual run
jobs:
build_and_deploy:
# Use the standard runner, the container handles the x86-64 to cross-compile setup
runs-on: ubuntu-latest
# --- JOB-LEVEL CONTAINER DEFINITION ---
# This runs the entire job inside the Debian environment, making all 'run' steps clean.
container:
image: debian:bullseye
steps:
# Checkout the source code (this runs INSIDE the container and populates /github/workspace)
- uses: actions/checkout@v4
# Display what we are going to compile
- name: Display Checked-Out Version
run: |
echo "--- Workflow Context ---"
# github.ref_name is the branch name or tag name (e.g., 'main' or 'v2.11')
echo "Checked out Reference Name (Branch/Tag): ${{ github.ref_name }}"
# github.ref is the full Git reference (e.g., 'refs/heads/main' or 'refs/tags/v2.11')
echo "Full GitHub Reference: ${{ github.ref }}"
echo "--- Starting Build ---"
# 2. Optimized Cross-Compile step
- name: Setup build environment for ARM64 and ARMHF
# Using a standard 'run' block as we are already inside the container
run: |
# Enable cross-architectures
dpkg --add-architecture armhf
dpkg --add-architecture arm64
# Update and Install ALL dependencies (APT requires update after add-architecture)
apt-get update -y
apt-get install -y \
build-essential \
crossbuild-essential-armhf \
crossbuild-essential-arm64 \
libsystemd-dev \
libsystemd-dev:arm64 \
libsystemd-dev:armhf
- name: Compile AqualinkD
# Using a standard 'run' block as we are already inside the container
run: |
make clean && \
make buildrelease
# The remaining steps automatically run inside the container as well
- name: Create release archive
# This step correctly archives both resulting binaries from the workspace
run: tar -czvf aqualinkd-release.tar.gz web/ release/
# --- Create/Update the Draft Development Release ---
- name: Create or Update GitHub Draft Release
if: ${{ (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }}
uses: softprops/action-gh-release@v2
with:
files: aqualinkd-release.tar.gz
overwrite: true
tag_name: development-latest
name: Development Build (Latest Main/Manual)
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- Create the Formal Versioned Release ---
- name: Create Final GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
files: aqualinkd-release.tar.gz
overwrite: true
tag_name: ${{ github.ref_name }}
name: AqualinkD Release ${{ github.ref_name }}
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}