From 8a7333b8990db3cee51d79f5146021226efb69d7 Mon Sep 17 00:00:00 2001 From: Steven Tang Date: Tue, 6 Sep 2022 20:16:22 +1000 Subject: [PATCH 1/2] build: test release architectures --- .github/workflows/release.yml | 53 +++++++++++++++-------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c4d65d..7ee4699 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,20 @@ name: Release on: - release: - types: - - published + push: + # release: + # types: + # - published jobs: release: name: 'Build, package and release to GitHub' - + runs-on: ubuntu-latest strategy: - fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - include: - - platform: ubuntu-latest - alias: linux - - platform: macos-latest - alias: mac - - platform: windows-latest - alias: win + GOOS: [darwin, windows, linux] + GOARCH: [amd64, arm64] - runs-on: ${{ matrix.platform }} steps: - name: Set up Go 1.x @@ -40,24 +33,22 @@ jobs: || git symbolic-ref -q --short HEAD \ || git rev-parse --short HEAD) > version.txt 2> /dev/null - - name: Get dependencies - run: go get + - name: Prepare + run: | + mkdir -p dist/ && cd dist/ + cp ../config.default.yml config.yml - name: Build - run: go build -v . - - - name: Compress working folder on Windows - if: runner.os == 'Windows' + working-directory: ./dist run: | - cp .\config.default.yml .\config.yml - Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.alias }}_amd64.zip - - name: Compress working folder on Unix - if: runner.os != 'Windows' - run: | - cp config.default.yml config.yml - zip -9 wakapi_${{ matrix.alias }}_amd64.zip wakapi config.yml + GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} go build -v ../ - - name: Upload built executable to Release - uses: softprops/action-gh-release@v1 - with: - files: wakapi_${{ matrix.alias }}_amd64.zip + - name: Compress working folder + working-directory: ./dist + run: | + zip -9 wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip * + + # - name: Upload built executable to Release + # uses: softprops/action-gh-release@v1 + # with: + # files: wakapi_${{ matrix.alias }}_amd64.zip From ffb0b84d78f9462d74f700a80b23970f78e8cd4d Mon Sep 17 00:00:00 2001 From: Steven Tang Date: Tue, 6 Sep 2022 20:41:04 +1000 Subject: [PATCH 2/2] build: re-enable release steps --- .github/workflows/release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ee4699..b49b475 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,16 @@ name: Release on: - push: - # release: - # types: - # - published + release: + types: + - published jobs: release: name: 'Build, package and release to GitHub' runs-on: ubuntu-latest strategy: + fail-fast: false matrix: GOOS: [darwin, windows, linux] GOARCH: [amd64, arm64] @@ -48,7 +48,7 @@ jobs: run: | zip -9 wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip * - # - name: Upload built executable to Release - # uses: softprops/action-gh-release@v1 - # with: - # files: wakapi_${{ matrix.alias }}_amd64.zip + - name: Upload built executable to Release + uses: softprops/action-gh-release@v1 + with: + files: ./dist/*.zip