From 458bb7fb70c61681e3562eae6fe9f09ef32e6000 Mon Sep 17 00:00:00 2001 From: Samuel Warkentin Date: Mon, 9 Dec 2024 19:39:23 +0100 Subject: [PATCH 1/5] add arm support --- .github/workflows/build.yaml | 5 +++++ .github/workflows/release.yaml | 13 +++++++++++++ .goreleaser.yml | 1 + 3 files changed, 19 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e1bb5bb..e78d95d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,6 +17,11 @@ jobs: with: go-version: "1.22" + - name: Set up ARM environment variables + run: | + echo "GOARCH=arm64" >> $GITHUB_ENV + echo "GOOS=linux" >> $GITHUB_ENV + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 203b0d3..273893c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,6 +18,19 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.22" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and Push Multi-Arch Image + run: | + docker buildx create --use + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag quay.io/your_repo/your_image:${GITHUB_REF_NAME} \ + --tag quay.io/your_repo/your_image:latest \ + --push . + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index e13e79f..1413ea5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,6 +18,7 @@ builds: - linux goarch: - amd64 + - arm64 - <<: *defaultBuild id: mittnitectl binary: mittnitectl From 23529fe72d8e0df1e5128f83322e1978f424245a Mon Sep 17 00:00:00 2001 From: Samuel Warkentin Date: Mon, 9 Dec 2024 19:42:45 +0100 Subject: [PATCH 2/5] add arm support --- .github/workflows/build.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e78d95d..55f04f3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,6 +9,9 @@ on: jobs: build: runs-on: ubuntu-20.04 + strategy: + matrix: + arch: [amd64, arm64] steps: - uses: actions/checkout@v4 @@ -17,9 +20,9 @@ jobs: with: go-version: "1.22" - - name: Set up ARM environment variables + - name: Set environment variables for architecture run: | - echo "GOARCH=arm64" >> $GITHUB_ENV + echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV echo "GOOS=linux" >> $GITHUB_ENV - name: Run GoReleaser From c19de2777eb44e0901971cbf3560223769167773 Mon Sep 17 00:00:00 2001 From: Samuel Warkentin Date: Mon, 9 Dec 2024 19:43:50 +0100 Subject: [PATCH 3/5] add arm support --- .github/workflows/release.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 273893c..d3495ac 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,22 +7,34 @@ on: jobs: build: - name: Build and release image + name: Build and release image and binaries runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_TOKEN }}" quay.io - - name: Set up Go uses: actions/setup-go@v5 with: go-version: "1.22" + - name: Set environment variables for architecture + run: | + echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV + echo "GOOS=linux" >> $GITHUB_ENV + + - name: Build binaries for ${{ matrix.arch }} + run: | + go build -o output-${{ matrix.arch }} + - name: Set up Docker Buildx + if: ${{ matrix.arch == 'amd64' }} uses: docker/setup-buildx-action@v2 - name: Build and Push Multi-Arch Image + if: ${{ matrix.arch == 'amd64' }} run: | docker buildx create --use docker buildx build \ From 9b62390c62af8cc1253233a28c49c9085d20cd45 Mon Sep 17 00:00:00 2001 From: Samuel Warkentin Date: Wed, 11 Dec 2024 10:19:09 +0100 Subject: [PATCH 4/5] build without docker dependencies --- .github/workflows/release.yaml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d3495ac..dfb0ab7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,7 +7,7 @@ on: jobs: build: - name: Build and release image and binaries + name: Build and release binaries runs-on: ubuntu-latest strategy: matrix: @@ -27,21 +27,24 @@ jobs: - name: Build binaries for ${{ matrix.arch }} run: | - go build -o output-${{ matrix.arch }} + mkdir -p dist + go build -o dist/myapp-${{ matrix.arch }} . - - name: Set up Docker Buildx - if: ${{ matrix.arch == 'amd64' }} - uses: docker/setup-buildx-action@v2 + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: binaries-${{ matrix.arch }} + path: dist/myapp-${{ matrix.arch }} - - name: Build and Push Multi-Arch Image - if: ${{ matrix.arch == 'amd64' }} - run: | - docker buildx create --use - docker buildx build \ - --platform linux/amd64,linux/arm64 \ - --tag quay.io/your_repo/your_image:${GITHUB_REF_NAME} \ - --tag quay.io/your_repo/your_image:latest \ - --push . + release: + name: Release binaries + needs: build + runs-on: ubuntu-latest + steps: + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: dist - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 From 01cd86014fc2792504fea8b2b0bc7703c88a5424 Mon Sep 17 00:00:00 2001 From: Samuel Warkentin Date: Fri, 13 Dec 2024 10:35:19 +0100 Subject: [PATCH 5/5] revert build and release --- .github/workflows/build.yaml | 8 -------- .github/workflows/release.yaml | 34 +++------------------------------- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 55f04f3..e1bb5bb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,9 +9,6 @@ on: jobs: build: runs-on: ubuntu-20.04 - strategy: - matrix: - arch: [amd64, arm64] steps: - uses: actions/checkout@v4 @@ -20,11 +17,6 @@ jobs: with: go-version: "1.22" - - name: Set environment variables for architecture - run: | - echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV - echo "GOOS=linux" >> $GITHUB_ENV - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dfb0ab7..203b0d3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,45 +7,17 @@ on: jobs: build: - name: Build and release binaries + name: Build and release image runs-on: ubuntu-latest - strategy: - matrix: - arch: [amd64, arm64] steps: - uses: actions/checkout@v4 + - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_TOKEN }}" quay.io + - name: Set up Go uses: actions/setup-go@v5 with: go-version: "1.22" - - - name: Set environment variables for architecture - run: | - echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV - echo "GOOS=linux" >> $GITHUB_ENV - - - name: Build binaries for ${{ matrix.arch }} - run: | - mkdir -p dist - go build -o dist/myapp-${{ matrix.arch }} . - - - name: Upload binaries - uses: actions/upload-artifact@v3 - with: - name: binaries-${{ matrix.arch }} - path: dist/myapp-${{ matrix.arch }} - - release: - name: Release binaries - needs: build - runs-on: ubuntu-latest - steps: - - name: Download all artifacts - uses: actions/download-artifact@v3 - with: - path: dist - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: