@@ -4,70 +4,131 @@ name: Release Harmony
44on :
55 push :
66 tags :
7- - ' **' # match all tags, e.g. 1.0.0, release-1, beta, etc.
7+ - ' **' # Match all tags, e.g. 1.0.0, release-1, beta, etc.
88 workflow_dispatch :
99
1010env :
1111 CARGO_TERM_COLOR : always
1212 REGISTRY_GHCR : ghcr.io/aurabx/harmony
1313 REGISTRY_DOCKERHUB : aurabox/harmony
1414 IMAGE_NAME : harmony
15+ PKG_CONFIG_ALLOW_CROSS : 1
1516
1617jobs :
17- # ---------- 1. Build binaries ----------
1818 build-binaries :
19- name : Build Harmony binaries (cross/native)
19+ runs-on : ${{ matrix.os }}
2020 strategy :
21+ fail-fast : false
2122 matrix :
2223 include :
23- - os : ubuntu-latest
24- target : x86_64-unknown-linux-musl
25- - os : ubuntu-latest
26- target : aarch64-unknown-linux-musl
27- - os : windows-latest
28- target : x86_64-pc-windows-msvc
24+ # Linux (most common distros and containers)
25+ - os : ubuntu-22.04
26+ target : x86_64-unknown-linux-gnu # Ubuntu, Debian, Fedora, RHEL, etc.
27+ - os : ubuntu-22.04
28+ target : aarch64-unknown-linux-gnu # ARM64 Ubuntu/Debian servers
29+
30+ # macOS (Intel + Apple Silicon)
2931 - os : macos-latest
3032 target : x86_64-apple-darwin
3133 - os : macos-latest
3234 target : aarch64-apple-darwin
33- runs-on : ${{ matrix.os }}
35+
36+ # Windows (x64)
37+ - os : windows-latest
38+ target : x86_64-pc-windows-msvc
3439
3540 steps :
3641 - name : Checkout
3742 uses : actions/checkout@v4
3843
44+ - name : Cache Rust build
45+ uses : Swatinem/rust-cache@v2
46+ with :
47+ cache-all-targets : true
48+ # Use different cache for cross-compilation to avoid glibc version conflicts
49+ key : ${{ matrix.target }}
50+
3951 - name : Install Rust toolchain
4052 uses : dtolnay/rust-toolchain@stable
4153 with :
4254 targets : ${{ matrix.target }}
4355
44- # Linux builds use cross
45- - name : Build Harmony (Linux cross)
46- if : runner.os == 'Linux'
47- shell : bash
56+ # --- Linux native build dependencies ---
57+ - name : Install system dependencies for native Linux builds
58+ if : matrix.target == 'x86_64-unknown-linux-gnu'
4859 run : |
49- cargo install cross --git https://github.com/cross-rs/cross
50- cross build --release --target ${{ matrix.target }}
60+ sudo apt-get update
61+ sudo apt-get install -y libdbus-1-dev pkg-config libssl-dev
5162
52- # Non-Linux builds are native
53- - name : Build Harmony (native)
54- if : runner.os != 'Linux '
55- run : cargo build --release --target ${{ matrix.target }}
63+ # --- Cross Compilation Setup (ARM) ---
64+ - name : Install cross for ARM builds
65+ if : matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'armv7-unknown-linux-gnueabihf '
66+ run : cargo install cross --git https://github.com/cross-rs/cross
5667
68+ # --- macOS OpenSSL setup ---
69+ - name : Install OpenSSL on macOS
70+ if : runner.os == 'macOS'
71+ run : |
72+ brew install --quiet openssl@3 pkg-config
73+ echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
74+ echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> $GITHUB_ENV
75+ echo "LIBRARY_PATH=$(brew --prefix openssl@3)/lib" >> $GITHUB_ENV
76+ echo "LDFLAGS=-L$(brew --prefix openssl@3)/lib" >> $GITHUB_ENV
77+ echo "CPPFLAGS=-I$(brew --prefix openssl@3)/include" >> $GITHUB_ENV
78+
79+ # --- Build step per OS ---
80+ - name : Build Harmony
81+ shell : bash
82+ run : |
83+ case "${{ runner.os }}" in
84+ Windows)
85+ echo "Building for Windows..."
86+ cargo build --release --target ${{ matrix.target }}
87+ ;;
88+ macOS)
89+ echo "Building for macOS..."
90+ cargo build --release --target ${{ matrix.target }}
91+ ;;
92+ Linux)
93+ case "${{ matrix.target }}" in
94+ *musl*)
95+ echo "Skipping musl targets due to DBus dependency"
96+ exit 0
97+ ;;
98+ aarch64-unknown-linux-gnu|armv7-unknown-linux-gnueabihf)
99+ echo "Building for ARM target ${{ matrix.target }} with cross..."
100+ cross build --release --target ${{ matrix.target }}
101+ ;;
102+ *)
103+ echo "Building for Linux target ${{ matrix.target }}..."
104+ cargo build --release --target ${{ matrix.target }}
105+ ;;
106+ esac
107+ ;;
108+ esac
109+
110+ # --- Package ---
57111 - name : Package artefacts
58112 shell : bash
59113 run : |
60114 mkdir -p release
61- cp target/${{ matrix.target }}/release/harmony* release/ || true
115+ cp target/${{ matrix.target }}/release/harmony* release/ 2>/dev/null || \
116+ cp target/${{ matrix.target }}/release/harmony.exe release/ || true
62117 cd release
63- tar czf harmony-${{ matrix.target }}.tar.gz harmony* || true
118+ if [ "${{ runner.os }}" = "Windows" ]; then
119+ tar czf harmony-${{ matrix.target }}.tar.gz harmony*.exe || true
120+ else
121+ tar czf harmony-${{ matrix.target }}.tar.gz harmony* || true
122+ fi
64123
124+ # --- Checksums ---
65125 - name : Generate SHA256 (Windows)
66126 if : runner.os == 'Windows'
67127 shell : pwsh
68128 run : |
69129 Get-FileHash "release/harmony-${{ matrix.target }}.tar.gz" -Algorithm SHA256 |
70- ForEach-Object { $_.Hash } | Out-File "release/harmony-${{ matrix.target }}.sha256" -Encoding ascii
130+ ForEach-Object { "$($_.Hash) harmony-${{ matrix.target }}.tar.gz" } |
131+ Out-File "release/harmony-${{ matrix.target }}.sha256" -Encoding ascii
71132
72133 - name : Generate SHA256 (non-Windows)
73134 if : runner.os != 'Windows'
86147 name : Build and push multi-arch Docker images
87148 runs-on : ubuntu-latest
88149 needs : build-binaries
150+ if : startsWith(github.ref, 'refs/tags/') # Only build Docker images for tags
89151 permissions :
90152 contents : read
91153 packages : write
99161
100162 - name : Prepare Linux binaries
101163 run : |
102- mv binaries/harmony-x86_64-unknown-linux-musl /harmony harmony-amd64 || true
103- mv binaries/harmony-aarch64-unknown-linux-musl /harmony harmony-arm64 || true
164+ mv binaries/harmony-x86_64-unknown-linux-gnu /harmony harmony-amd64 || true
165+ mv binaries/harmony-aarch64-unknown-linux-gnu /harmony harmony-arm64 || true
104166
105167 - uses : docker/setup-buildx-action@v3
106168
@@ -138,7 +200,7 @@ jobs:
138200 release :
139201 name : Publish GitHub Release
140202 runs-on : ubuntu-latest
141- needs : [build-binaries, docker]
203+ needs : [build-binaries] # Docker runs in parallel, doesn't block release
142204 if : startsWith(github.ref, 'refs/tags/')
143205 permissions :
144206 contents : write
@@ -148,8 +210,8 @@ jobs:
148210 uses : actions/download-artifact@v4
149211 with :
150212 path : ./artifacts
151- pattern : harmony-* # only match your real binaries
152- merge-multiple : true # flattens them into one directory
213+ pattern : harmony-* # Only match real binaries
214+ merge-multiple : true # Flattens them into one directory
153215
154216 - name : Generate combined checksums manifest
155217 shell : bash
@@ -165,5 +227,7 @@ jobs:
165227 tag_name : ${{ github.ref_name }}
166228 name : Harmony ${{ github.ref_name }}
167229 files : ./artifacts/**/*
230+ draft : false
231+ prerelease : ${{ contains(github.ref, 'beta') }}
168232 env :
169- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
233+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments