|
1 | | -name: build-release |
| 1 | +# .github/workflows/release.yml |
| 2 | +name: Release CLI |
2 | 3 |
|
3 | 4 | on: |
4 | 5 | push: |
5 | 6 | tags: |
6 | | - - "v*" |
7 | | - workflow_dispatch: {} |
| 7 | + - '**' # match all tags, e.g. 1.0.0, release-1, beta, etc. |
| 8 | + workflow_dispatch: |
8 | 9 |
|
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 |
11 | 15 |
|
12 | 16 | jobs: |
13 | | - build: |
14 | | - name: build (${{ matrix.os }} / ${{ matrix.target }}) |
| 17 | + # ---------- 1. Build binaries ---------- |
| 18 | + build-binaries: |
| 19 | + name: Build Harmony binaries (cross/native) |
15 | 20 | strategy: |
16 | | - fail-fast: false |
17 | 21 | matrix: |
18 | 22 | include: |
19 | 23 | - os: ubuntu-latest |
20 | 24 | 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 |
27 | 27 | - os: windows-latest |
28 | 28 | 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 |
31 | 33 | runs-on: ${{ matrix.os }} |
| 34 | + |
32 | 35 | steps: |
33 | | - - uses: actions/checkout@v4 |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
34 | 38 |
|
35 | | - - name: Setup Rust |
| 39 | + - name: Install Rust toolchain |
36 | 40 | uses: dtolnay/rust-toolchain@stable |
37 | 41 | with: |
38 | 42 | targets: ${{ matrix.target }} |
39 | 43 |
|
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 |
42 | 48 | 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 }} |
45 | 51 |
|
46 | | - - name: Build |
| 52 | + # Non-Linux builds are native |
| 53 | + - name: Build Harmony (native) |
| 54 | + if: runner.os != 'Linux' |
47 | 55 | run: cargo build --release --target ${{ matrix.target }} |
48 | 56 |
|
49 | | - - name: Determine version |
50 | | - id: version |
| 57 | + - name: Package artefacts |
51 | 58 | shell: bash |
52 | 59 | 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 |
55 | 64 |
|
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' |
57 | 74 | shell: bash |
58 | 75 | 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 |
74 | 77 |
|
75 | | - - name: Upload artifacts |
| 78 | + - name: Upload artefacts |
76 | 79 | uses: actions/upload-artifact@v4 |
77 | 80 | 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/ |
80 | 83 |
|
| 84 | + # ---------- 3. Publish GitHub Release ---------- |
81 | 85 | release: |
82 | | - needs: build |
83 | | - if: startsWith(github.ref, 'refs/tags/') |
| 86 | + name: Publish GitHub Release |
84 | 87 | runs-on: ubuntu-latest |
| 88 | + needs: [build-binaries] |
| 89 | + if: startsWith(github.ref, 'refs/tags/') |
85 | 90 | permissions: |
86 | 91 | contents: write |
| 92 | + |
87 | 93 | steps: |
88 | | - - uses: actions/download-artifact@v4 |
| 94 | + - name: Download Harmony build artefacts only |
| 95 | + uses: actions/download-artifact@v4 |
89 | 96 | 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 |
92 | 108 |
|
93 | | - - name: Create GitHub Release and upload assets |
| 109 | + - name: Create GitHub Release |
94 | 110 | uses: softprops/action-gh-release@v2 |
95 | 111 | 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