From 4529785ee905c1f8ec49ffae2207de0a37e87e42 Mon Sep 17 00:00:00 2001 From: "jakub.coufal" Date: Tue, 25 Apr 2023 11:55:59 +0200 Subject: [PATCH 1/2] Add windows release build --- .github/workflows/release.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8aed1cb..92c8866 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,8 +16,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - goos: [linux, darwin] - goarch: [arm64, amd64] + goos: [linux, windows, darwin] + goarch: [386, arm64, amd64] + exclude: + - goarch: "386" + goos: darwin steps: - name: Checkout the latest code uses: actions/checkout@v3 @@ -31,10 +34,12 @@ jobs: GOARCH: ${{ matrix.goarch }} shell: bash run: | - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ${{ env.BINARY_NAME }} -ldflags '-w -s -X 'github.com/wandera/${{ env.BINARY_NAME }}/cmd.Version=${{ env.TAG }} \ - && mkdir dist \ - && mv ${{ env.BINARY_NAME }} dist/${{ env.BINARY_NAME }} \ - && tar -czvf ${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz -C dist/ . + if [ "$GOOS" = "windows" ]; then + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/${{ env.BINARY_NAME }}.exe -ldflags '-w -s -X 'github.com/wandera/${{ env.BINARY_NAME }}/cmd.Version=${{ env.TAG }} + else + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/${{ env.BINARY_NAME }} -ldflags '-w -s -X 'github.com/wandera/${{ env.BINARY_NAME }}/cmd.Version=${{ env.TAG }} + fi + tar -czvf ${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz -C dist/ . - name: Release uses: wandera/action-gh-release@v1 with: From 1d820662e20cce6e9e2bdd0c008e3b943ddba1aa Mon Sep 17 00:00:00 2001 From: "jakub.coufal" Date: Tue, 25 Apr 2023 12:00:51 +0200 Subject: [PATCH 2/2] Add arm platform image and improve tagging --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92c8866..be6ea53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,11 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{raw}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + type=sha - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -76,7 +81,9 @@ jobs: with: push: true context: . + platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ github.ref_name }} tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}