Skip to content

Commit

Permalink
Update build system
Browse files Browse the repository at this point in the history
  • Loading branch information
alebeck committed Oct 21, 2024
1 parent 53ce4a1 commit 99e8775
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}"
Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

16 changes: 16 additions & 0 deletions build_grid.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 99e8775

Please sign in to comment.