Skip to content

Commit

Permalink
Merge pull request #40 from wandera/release_imp
Browse files Browse the repository at this point in the history
Add windows release build
  • Loading branch information
coufalja authored Apr 25, 2023
2 parents 8365231 + 1d82066 commit b711abd
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -62,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
Expand All @@ -71,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 }}

0 comments on commit b711abd

Please sign in to comment.