From 30a7bceb3c23e97a1d91bc3708cd60584f59464c Mon Sep 17 00:00:00 2001 From: Mateusz Charytoniuk Date: Mon, 15 Jul 2024 17:01:07 +0200 Subject: [PATCH] feat: build matrix --- .github/workflows/release.yml | 51 +++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86bd0cd..59de6ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,10 +8,25 @@ on: - "**" jobs: - release: - name: create release + build: + name: build runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + + strategy: + matrix: + include: + - goos: darwin + goarch: amd64 + artifact_name: paddler-bin-darwin-amd64 + - goos: darwin + goarch: arm64 + artifact_name: paddler-bin-darwin-arm64 + - goos: linux + goarch: amd64 + artifact_name: paddler-bin-linux-amd64 + - goos: windows + goarch: amd64 + artifact_name: paddler-bin-windows-amd64.exe steps: - name: checkout code @@ -22,9 +37,10 @@ jobs: with: go-version: '1.21' - - name: build + - name: Build run: | - make paddler-bin-linux-x64 + make -C management build + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ${{ matrix.artifact_name }} - name: determine tag type id: tag_type @@ -37,22 +53,11 @@ jobs: echo "tag_type=INVALID_TAG" >> $GITHUB_OUTPUT fi - - name: create pre-release - id: create_prerelease - if: steps.tag_type.outputs.tag_type == 'PRE_RELEASE_TAG' - uses: softprops/action-gh-release@v2 - with: - fail_on_unmatched_files: true - files: paddler-bin-linux-x64 - generate_release_notes: true - prerelease: true - - - name: create release - id: create_release - if: steps.tag_type.outputs.tag_type == 'RELEASE_TAG' - uses: softprops/action-gh-release@v2 + - name: upload binaries to release + uses: svenstaro/upload-release-action@v2 with: - fail_on_unmatched_files: true - files: paddler-bin-linux-x64 - generate_release_notes: true - prerelease: false + file: ${{ matrix.artifact_name }} + asset_name: ${{ matrix.artifact_name }} + overwrite: true + prerelease: steps.tag_type.outputs.tag_type == 'PRE_RELEASE_TAG' + tag: ${{ github.ref }}