44 release :
55 types : [created]
66
7+ env :
8+ RUST_VERSION : 1.80
9+
710jobs :
11+ detect-windows-dockerfile :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ has_dockerfile : ${{ steps.check.outputs.has }}
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+ - id : check
19+ name : Check for Dockerfile.windows
20+ run : |
21+ if [ -f Dockerfile.windows ]; then
22+ echo "has=true" >> $GITHUB_OUTPUT
23+ else
24+ echo "has=false" >> $GITHUB_OUTPUT
25+ fi
26+
827 linux-build :
928 runs-on : ubuntu-latest
1029 permissions :
@@ -29,40 +48,43 @@ jobs:
2948 push : true
3049 platforms : linux/amd64,linux/arm64,linux/arm/v7
3150 tags : ghcr.io/${{ github.repository_owner }}/resonix-node:linux-latest
51+ build-args : |
52+ RUST_VERSION=${{ env.RUST_VERSION }}
3253
3354 windows-build :
55+ needs : detect-windows-dockerfile
56+ if : needs.detect-windows-dockerfile.outputs.has_dockerfile == 'true'
3457 runs-on : windows-latest
3558 permissions :
3659 contents : read
3760 packages : write
3861 steps :
3962 - name : Checkout repository
4063 uses : actions/checkout@v4
41- - name : Set up Docker (Windows)
42- run : docker version
4364 - name : Set up Docker Buildx
4465 uses : docker/setup-buildx-action@v3
45- with :
46- driver : docker
4766 - name : Log in to GHCR
4867 uses : docker/login-action@v3
4968 with :
5069 registry : ghcr.io
5170 username : ${{ github.actor }}
5271 password : ${{ secrets.GITHUB_TOKEN }}
53- - name : Build and push Windows amd64 image
72+ - name : Build and push Windows image (amd64)
5473 uses : docker/build-push-action@v5
5574 with :
5675 context : .
5776 file : ./Dockerfile.windows
5877 push : true
5978 platforms : windows/amd64
60- tags : ghcr.io/${{ github.repository_owner }}/resonix-node:windows-amd64-latest
79+ tags : ghcr.io/${{ github.repository_owner }}/resonix-node:windows-latest
80+ build-args : |
81+ RUST_VERSION=${{ env.RUST_VERSION }}
6182
62- manifest :
83+ create- manifest :
6384 needs : [linux-build, windows-build]
6485 runs-on : ubuntu-latest
6586 permissions :
87+ contents : read
6688 packages : write
6789 steps :
6890 - name : Log in to GHCR
@@ -71,20 +93,18 @@ jobs:
7193 registry : ghcr.io
7294 username : ${{ github.actor }}
7395 password : ${{ secrets.GITHUB_TOKEN }}
74- - name : Create and push multi-platform manifest (linux + windows )
96+ - name : Create and push manifest (latest )
7597 run : |
76- set -eux
77- IMAGE=ghcr.io/${{ github.repository_owner }}/resonix-node
78- # Pull images built in previous jobs
79- docker pull $IMAGE:linux-latest
80- docker pull $IMAGE:windows-amd64-latest
81- # Retag per platform
82- docker tag $IMAGE:linux-latest $IMAGE:latest-linux
83- docker tag $IMAGE:windows-amd64-latest $IMAGE:latest-windows-amd64
84- # Create manifest referencing both
85- docker manifest create $IMAGE:latest \
86- --amend $IMAGE:latest-linux \
87- --amend $IMAGE:latest-windows-amd64 || true
88- # Annotate (linux manifest already multi-arch)
89- docker manifest annotate $IMAGE:latest $IMAGE:latest-windows-amd64 --os windows --arch amd64 || true
90- docker manifest push --purge $IMAGE:latest
98+ set -e
99+ # If windows build succeeded, include both; else only linux
100+ if [ "${{ needs.windows-build.result }}" = "success" ]; then
101+ docker buildx imagetools create \
102+ -t ghcr.io/${{ github.repository_owner }}/resonix-node:latest \
103+ ghcr.io/${{ github.repository_owner }}/resonix-node:linux-latest \
104+ ghcr.io/${{ github.repository_owner }}/resonix-node:windows-latest
105+ else
106+ docker buildx imagetools create \
107+ -t ghcr.io/${{ github.repository_owner }}/resonix-node:latest \
108+ ghcr.io/${{ github.repository_owner }}/resonix-node:linux-latest
109+ fi
110+ docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/resonix-node:latest
0 commit comments