From 91d70e462946d9c73c7e049d27fa6ae9ddf57723 Mon Sep 17 00:00:00 2001 From: John McBride Date: Tue, 15 Aug 2023 14:48:11 -0600 Subject: [PATCH] feat: GitHub action to build and upload Go artifacts after release created Signed-off-by: John McBride --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..812a4be --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Build Go release artifacts + +on: + release: + types: + - created + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write # release changes require contents write + strategy: + matrix: + goos: [darwin, linux, windows] + goarch: [amd64, arm64] + + steps: + - name: Set up Go + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version: 1.21 + + - name: Check out code + uses: actions/checkout@v3 + + - name: Build and upload Go binaries + env: + GH_TOKEN: ${{ github.token }} + run: | + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/pizza-${{ matrix.goos }}-${{ matrix.goarch }} + gh release upload ${{ github.event.release.tag_name }} build/pizza-${{ matrix.goos }}-${{ matrix.goarch }}