4545 build-release-image-and-linux-artifacts :
4646 name : Build Linux Artifacts and Images
4747 needs : [create-release]
48- strategy :
49- matrix :
50- include :
51- - arch : x86_64
52- runner : ubuntu-latest
53- - arch : aarch64
54- runner : ubuntu-24.04-arm
55- runs-on : ${{ matrix.runner }}
48+ runs-on : ubuntu-latest
5649 permissions :
5750 contents : write
5851 packages : write
@@ -72,67 +65,38 @@ jobs:
7265 with :
7366 images : ${{ env.REGISTRY }}/${{ github.repository }}
7467 tags : |
75- type=raw,value=latest-${{ matrix.arch }}
76-
77- - name : Debug Git ref
78- run : |
79- echo "GITHUB_REF: $GITHUB_REF"
80- echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
81- echo "GITHUB_SHA: $GITHUB_SHA"
82- echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
68+ type=raw,value=${{ github.ref_name }}
69+ type=raw,value=latest
8370
84- - name : Build and push Docker image
71+ - name : Build and push multi-arch Docker images
8572 uses : docker/build-push-action@v6
8673 with :
8774 file : Dockerfile
8875 context : .
8976 push : true
77+ platforms : linux/amd64,linux/arm64
9078 tags : ${{ steps.meta.outputs.tags }}
9179
92- - name : Prepare Linux Binary
80+ - name : Prepare Linux Binaries
9381 shell : bash
9482 run : |
95- IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep -- '-${{ matrix.arch }}$' | head -n 1)
96- docker create --name temp-container $IMAGE_TAG \
97- && docker cp temp-container:/app/${RELEASE_BIN} ./${RELEASE_BIN} \
98- && docker rm temp-container \
99- && tar -czf ${RELEASE_BIN}-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz ${RELEASE_BIN}
100-
101- - name : Upload Linux Release Asset
83+ for arch in x86_64 aarch64; do
84+ IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep -- "-$arch$" | head -n 1)
85+ docker create --name temp-container $IMAGE_TAG
86+ docker cp temp-container:/app/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}-$arch
87+ docker rm temp-container
88+ tar -czf ${{ env.RELEASE_BIN }}-linux-$arch-${{ github.ref_name }}.tar.gz ${{ env.RELEASE_BIN }}-$arch
89+ done
90+
91+ - name : Upload Linux Release Assets
10292 shell : bash
10393 run : |
104- gh release upload "${{ github.ref_name }}" ${RELEASE_BIN}-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz
94+ for arch in x86_64 aarch64; do
95+ gh release upload "${{ github.ref_name }}" ${{ env.RELEASE_BIN }}-linux-$arch-${{ github.ref_name }}.tar.gz
96+ done
10597 env :
10698 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10799
108- create-image-manifest :
109- name : Create Image Manifest
110- needs : build-release-image-and-linux-artifacts
111- runs-on : ubuntu-latest
112- permissions :
113- packages : write
114- contents : read
115- steps :
116- - name : Log in to the Container registry
117- uses : docker/login-action@v3
118- with :
119- registry : ${{ env.REGISTRY }}
120- username : ${{ github.actor }}
121- password : ${{ secrets.GITHUB_TOKEN }}
122-
123- - name : Create and push manifests
124- shell : bash
125- run : |
126- REPO=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr '[A-Z]' '[a-z]')
127- VERSION=${REPO}:${{ github.ref_name }}
128- LATEST=${REPO}:latest
129-
130- docker manifest create $VERSION --amend ${LATEST}-x86_64 --amend ${LATEST}-aarch64 \
131- && docker manifest push $VERSION
132-
133- docker manifest create $LATEST --amend ${LATEST}-x86_64 --amend ${LATEST}-aarch64 \
134- && docker manifest push $LATEST
135-
136100 build-mac-artifacts :
137101 name : Build Mac Artifacts
138102 needs : create-release
0 commit comments