diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9eb4e59..d51ef61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,6 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - strategy: - matrix: - goos: [linux, darwin] - goarch: [amd64, arm64] steps: - name: Checkout code uses: actions/checkout@v4 @@ -22,16 +18,12 @@ jobs: with: go-version: 1.23 - name: Build - run: | - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o boring ./cmd/boring - - name: Compress Binary - run: | - tar -czvf boring-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz boring - - name: Upload binaries to release + run: ./build_grid.sh + - name: Release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: boring-*.tar.gz + file: ./dist/boring-*.tar.gz file_glob: true tag: ${{ github.ref }} body: "Automatic build release for version ${{ github.ref_name }}" diff --git a/build.sh b/build.sh index f653b1e..1b98dd9 100755 --- a/build.sh +++ b/build.sh @@ -3,10 +3,11 @@ tag=$(git describe --tags --exact-match 2>/dev/null) commit=$(git rev-parse --short HEAD 2>/dev/null) -mkdir -p ./bin +dir=${1:-./bin} +mkdir -p $dir go build \ -ldflags "-X main.version=$tag -X main.commit=$commit" \ - -o ./bin/boring \ + -o $dir/boring \ ./cmd/boring diff --git a/build_grid.sh b/build_grid.sh new file mode 100755 index 0000000..aad6ee4 --- /dev/null +++ b/build_grid.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +oss="darwin linux" +archs="amd64 arm64" + +tag=$(git describe --tags --exact-match) + +for os in $oss; do + for arch in $archs; do + GOOS=$os GOARCH=$arch ./build.sh ./dist + tar -czf ./dist/boring-$tag-$os-$arch.tar.gz LICENSE -C ./dist boring + rm ./dist/boring + done +done