Skip to content

Commit 1f153bc

Browse files
committed
chore(workflow): github release
1 parent 43e565e commit 1f153bc

1 file changed

Lines changed: 73 additions & 54 deletions

File tree

.github/workflows/release.yml

Lines changed: 73 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,116 @@
1-
name: build-release
1+
# .github/workflows/release.yml
2+
name: Release CLI
23

34
on:
45
push:
56
tags:
6-
- "v*"
7-
workflow_dispatch: {}
7+
- '**' # match all tags, e.g. 1.0.0, release-1, beta, etc.
8+
workflow_dispatch:
89

9-
permissions:
10-
contents: read
10+
env:
11+
CARGO_TERM_COLOR: always
12+
REGISTRY_GHCR: ghcr.io/aurabx/harmony
13+
REGISTRY_DOCKERHUB: aurabox/harmony
14+
IMAGE_NAME: harmony
1115

1216
jobs:
13-
build:
14-
name: build (${{ matrix.os }} / ${{ matrix.target }})
17+
# ---------- 1. Build binaries ----------
18+
build-binaries:
19+
name: Build Harmony binaries (cross/native)
1520
strategy:
16-
fail-fast: false
1721
matrix:
1822
include:
1923
- os: ubuntu-latest
2024
target: x86_64-unknown-linux-musl
21-
artifact_name: runbeam-linux-x86_64
22-
archive: tar.gz
23-
- os: macos-latest
24-
target: aarch64-apple-darwin
25-
artifact_name: runbeam-macos-aarch64
26-
archive: tar.gz
25+
- os: ubuntu-latest
26+
target: aarch64-unknown-linux-musl
2727
- os: windows-latest
2828
target: x86_64-pc-windows-msvc
29-
artifact_name: runbeam-windows-x86_64
30-
archive: zip
29+
- os: macos-latest
30+
target: x86_64-apple-darwin
31+
- os: macos-latest
32+
target: aarch64-apple-darwin
3133
runs-on: ${{ matrix.os }}
34+
3235
steps:
33-
- uses: actions/checkout@v4
36+
- name: Checkout
37+
uses: actions/checkout@v4
3438

35-
- name: Setup Rust
39+
- name: Install Rust toolchain
3640
uses: dtolnay/rust-toolchain@stable
3741
with:
3842
targets: ${{ matrix.target }}
3943

40-
- name: Install musl tools (Linux)
41-
if: matrix.target == 'x86_64-unknown-linux-musl'
44+
# Linux builds use cross
45+
- name: Build Harmony (Linux cross)
46+
if: runner.os == 'Linux'
47+
shell: bash
4248
run: |
43-
sudo apt-get update
44-
sudo apt-get install -y musl-tools
49+
cargo install cross --git https://github.com/cross-rs/cross
50+
cross build --release --target ${{ matrix.target }}
4551
46-
- name: Build
52+
# Non-Linux builds are native
53+
- name: Build Harmony (native)
54+
if: runner.os != 'Linux'
4755
run: cargo build --release --target ${{ matrix.target }}
4856

49-
- name: Determine version
50-
id: version
57+
- name: Package artefacts
5158
shell: bash
5259
run: |
53-
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
54-
echo "version=$VERSION" >> $GITHUB_OUTPUT
60+
mkdir -p release
61+
cp target/${{ matrix.target }}/release/harmony* release/ || true
62+
cd release
63+
tar czf harmony-${{ matrix.target }}.tar.gz harmony* || true
5564
56-
- name: Package artifact
65+
- name: Generate SHA256 (Windows)
66+
if: runner.os == 'Windows'
67+
shell: pwsh
68+
run: |
69+
Get-FileHash "release/harmony-${{ matrix.target }}.tar.gz" -Algorithm SHA256 |
70+
ForEach-Object { $_.Hash } | Out-File "release/harmony-${{ matrix.target }}.sha256" -Encoding ascii
71+
72+
- name: Generate SHA256 (non-Windows)
73+
if: runner.os != 'Windows'
5774
shell: bash
5875
run: |
59-
mkdir -p tmp
60-
if [[ "${{ runner.os }}" == "Windows" ]]; then
61-
BIN_PATH="target/${{ matrix.target }}/release/runbeam.exe"
62-
OUT="tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.exe"
63-
cp "$BIN_PATH" "$OUT"
64-
7z a "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.zip" "$OUT"
65-
certutil -hashfile "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.zip" SHA256 | sed -n '2p' > "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.zip.sha256"
66-
else
67-
BIN_PATH="target/${{ matrix.target }}/release/runbeam"
68-
OUT="tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}"
69-
cp "$BIN_PATH" "$OUT"
70-
if [[ "${{ runner.os }}" == "macOS" ]]; then strip -x "$OUT" || true; else strip --strip-unneeded "$OUT" || true; fi
71-
tar -C tmp -czf "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.tar.gz" "$(basename "$OUT")"
72-
shasum -a 256 "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.tar.gz" > "tmp/${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}.tar.gz.sha256"
73-
fi
76+
shasum -a 256 release/harmony-${{ matrix.target }}.tar.gz > release/harmony-${{ matrix.target }}.sha256
7477
75-
- name: Upload artifacts
78+
- name: Upload artefacts
7679
uses: actions/upload-artifact@v4
7780
with:
78-
name: ${{ matrix.artifact_name }}-v${{ steps.version.outputs.version }}
79-
path: tmp/*${{ steps.version.outputs.version }}*
81+
name: harmony-${{ matrix.target }}
82+
path: release/
8083

84+
# ---------- 3. Publish GitHub Release ----------
8185
release:
82-
needs: build
83-
if: startsWith(github.ref, 'refs/tags/')
86+
name: Publish GitHub Release
8487
runs-on: ubuntu-latest
88+
needs: [build-binaries]
89+
if: startsWith(github.ref, 'refs/tags/')
8590
permissions:
8691
contents: write
92+
8793
steps:
88-
- uses: actions/download-artifact@v4
94+
- name: Download Harmony build artefacts only
95+
uses: actions/download-artifact@v4
8996
with:
90-
path: artifacts
91-
merge-multiple: true
97+
path: ./artifacts
98+
pattern: harmony-* # only match your real binaries
99+
merge-multiple: true # flattens them into one directory
100+
101+
- name: Generate combined checksums manifest
102+
shell: bash
103+
run: |
104+
cd artifacts
105+
find . -type f -name "*.sha256" -exec cat {} \; > checksums.txt
106+
echo "Combined checksums:"
107+
cat checksums.txt
92108
93-
- name: Create GitHub Release and upload assets
109+
- name: Create GitHub Release
94110
uses: softprops/action-gh-release@v2
95111
with:
96-
files: artifacts/**
97-
fail_on_unmatched_files: true
112+
tag_name: ${{ github.ref_name }}
113+
name: Harmony ${{ github.ref_name }}
114+
files: ./artifacts/**/*
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)