diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml index 9047b3c5..e62acdf0 100644 --- a/.github/workflows/go-release.yml +++ b/.github/workflows/go-release.yml @@ -20,8 +20,6 @@ on: env: REGISTRY: ghcr.io # default is docker.io IMAGE_NAME: ${{ github.repository }} # -tools # e.g. user/fancy-project[-suffix] - ARCH: arm64 # for Makefile where we still use ARCH - GOOS: linux # for Makefile jobs: go-release-ghcr: @@ -30,6 +28,13 @@ jobs: permissions: packages: write # required to write to container registry # contents: write # for releases (e.g. go-releaser) + strategy: + matrix: + include: + - goos: linux + goarch: arm64 + #- goos: linux + # arch: amd64 steps: # checkout is essential if you use a different context than "." @@ -58,9 +63,9 @@ jobs: run: | make build env: - GOOS: ${{ env.GOOS }} + GOOS: ${{ matrix.goos }} # todo refactor Makefile to use GOARCH - ARCH: ${{ env.ARCH }} + ARCH: ${{ matrix.goarch }} CI: true RELEASE_NAME: ${{ env.RELEASE_NAME }} RELEASE_VERSION: ${{ env.RELEASE_VERSION }} @@ -85,17 +90,17 @@ jobs: # QEMU is a generic and open source machine & userspace emulator and virtualizer. # to emulating a complete machine in software without any need for hardware virtualization support -# - name: Set up QEMU static binaries -# uses: docker/setup-qemu-action@v3 -# with: -# # since we run platform specific builds in parallel, we only need the current platform -# platforms: ${{ env.GOOS }}/${{ env.ARCH }} + # it's required at least if you RUN things in your docker build and the target platform + # is *NOT* the platform of the runner (or you get messages like "exec /bin/sh: exec format error") + - name: Set up QEMU static binaries + uses: docker/setup-qemu-action@v3 + with: + # since we run platform specific builds in parallel, we only need the current platform + platforms: ${{ env.GOOS }}/${{ env.ARCH }} # explicit setup-buildx action required? No, at least standard worker comes with cli plugin -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main - + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 # https://github.com/docker/build-push-action?tab=readme-ov-file#usage - name: Build docker image @@ -103,9 +108,9 @@ jobs: uses: docker/build-push-action@v5 with: #${{ matrix.platform }} - platforms: ${{ env.GOOS }}/${{ env.ARCH }} + platforms: ${{ matrix.goos }}/${{ matrix.goarch }} context: ./go - # for none-multistage use true, otherwise false + # for none-multistage use true and merge manifest in 2nd job, otherwise false push: true # for multistage O NOT specify 'tags' here (error "get can't push tagged ref by digest") tags: ${{ steps.meta.outputs.tags }}