1+ # .github/workflows/release.yml
12name : Release Harmony
23
34on :
45 push :
56 tags :
6- - ' v*' # production releases
7+ - ' v*'
78 workflow_dispatch :
89
910env :
1011 CARGO_TERM_COLOR : always
11- REGISTRY : ghcr.io
12- IMAGE_NAME : ${{ github.repository }}
12+ REGISTRY_GHCR : ghcr.io/aurabx/harmony
13+ REGISTRY_DOCKERHUB : aurabx/harmony
14+ IMAGE_NAME : harmony
1315
1416jobs :
17+ # ---------- 1. Build binaries ----------
1518 build-binaries :
16- name : Build Rust binaries (cross/native)
19+ name : Build Harmony binaries (cross/native)
1720 strategy :
1821 matrix :
1922 include :
@@ -38,22 +41,18 @@ jobs:
3841 with :
3942 targets : ${{ matrix.target }}
4043
41- # Linux builds ( use cross)
44+ # Linux builds use cross
4245 - name : Build Harmony (Linux cross)
4346 if : runner.os == 'Linux'
4447 shell : bash
4548 run : |
46- echo "Detected Linux runner. Installing musl dependencies and using cross."
4749 cargo install cross --git https://github.com/cross-rs/cross
48- # Build for the target
4950 cross build --release --target ${{ matrix.target }}
5051
51- # Non-Linux builds (macOS + Windows)
52+ # Non-Linux builds are native
5253 - name : Build Harmony (native)
5354 if : runner.os != 'Linux'
54- run : |
55- echo "Detected non-Linux runner. Building natively."
56- cargo build --release --target ${{ matrix.target }}
55+ run : cargo build --release --target ${{ matrix.target }}
5756
5857 - name : Package artefacts
5958 shell : bash
8281 name : harmony-${{ matrix.target }}
8382 path : release/
8483
84+ # ---------- 2. Build and push Docker images ----------
8585 docker :
86- name : Build and push multi-arch Docker image
86+ name : Build and push multi-arch Docker images
8787 runs-on : ubuntu-latest
8888 needs : build-binaries
8989 permissions :
@@ -92,61 +92,77 @@ jobs:
9292 id-token : write
9393
9494 steps :
95- - name : Checkout
96- uses : actions/checkout@v4
95+ - uses : actions/checkout@v4
96+ - uses : actions/download-artifact@v4
97+ with :
98+ path : ./binaries
9799
98- - name : Set up Buildx
99- uses : docker/setup-buildx-action@v3
100+ - name : Prepare Linux binaries
101+ 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
104+
105+ - uses : docker/setup-buildx-action@v3
106+
107+ - name : Log in to Docker Hub
108+ uses : docker/login-action@v3
109+ with :
110+ username : ${{ secrets.DOCKERHUB_USERNAME }}
111+ password : ${{ secrets.DOCKERHUB_TOKEN }}
100112
101- - name : Login to GHCR
113+ - name : Log in to GHCR
102114 uses : docker/login-action@v3
103115 with :
104- registry : ${{ env.REGISTRY }}
116+ registry : ghcr.io
105117 username : ${{ github.actor }}
106118 password : ${{ secrets.GITHUB_TOKEN }}
107119
108120 - name : Compute image tags
109121 id : meta
110- shell : bash
111122 run : |
112- if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
113- echo "Detected release tag ${GITHUB_REF_NAME}"
114- echo "tags=${REGISTRY}/${IMAGE_NAME}:${GITHUB_REF_NAME},${REGISTRY}/${IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
115- else
116- SHORT_SHA="${GITHUB_SHA::7}"
117- SAFE_BRANCH="${GITHUB_REF_NAME//\//-}"
118- echo "tags=${REGISTRY}/${IMAGE_NAME}:${SAFE_BRANCH}-${SHORT_SHA}" >> $GITHUB_OUTPUT
119- fi
120- env :
121- REGISTRY : ${{ env.REGISTRY }}
122- IMAGE_NAME : ${{ env.IMAGE_NAME }}
123+ TAG=${GITHUB_REF_NAME}
124+ echo "tags=${{ env.REGISTRY_DOCKERHUB }}:${TAG},${{ env.REGISTRY_DOCKERHUB }}:latest,${{ env.REGISTRY_GHCR }}:${TAG},${{ env.REGISTRY_GHCR }}:latest" >> $GITHUB_OUTPUT
123125
124126 - name : Build and push
125127 uses : docker/build-push-action@v6
126128 with :
127129 context : .
130+ file : Dockerfile
128131 push : true
129132 platforms : linux/amd64,linux/arm64
130133 tags : ${{ steps.meta.outputs.tags }}
131134 cache-from : type=gha
132135 cache-to : type=gha,mode=max
133136
137+ # ---------- 3. Publish GitHub Release ----------
134138 release :
135139 name : Publish GitHub Release
136140 runs-on : ubuntu-latest
137141 needs : [build-binaries, docker]
138142 if : startsWith(github.ref, 'refs/tags/v')
143+ permissions :
144+ contents : write
145+
139146 steps :
140147 - name : Download artefacts
141148 uses : actions/download-artifact@v4
142149 with :
143150 path : ./artifacts
144151
152+ # Combine all SHA256 files into one manifest
153+ - name : Generate combined checksums manifest
154+ shell : bash
155+ run : |
156+ cd artifacts
157+ find . -type f -name "*.sha256" -exec cat {} \; > checksums.txt
158+ echo "Combined checksums:"
159+ cat checksums.txt
160+
145161 - name : Create GitHub Release
146162 uses : softprops/action-gh-release@v2
147163 with :
148164 tag_name : ${{ github.ref_name }}
149165 name : Harmony ${{ github.ref_name }}
150166 files : ./artifacts/**/*
151167 env :
152- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
168+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments