Skip to content

Commit

Permalink
Improves actions workflow build_and_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfhc committed Mar 19, 2022
1 parent 06f251b commit 94e54ca
Showing 1 changed file with 42 additions and 17 deletions.
59 changes: 42 additions & 17 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,48 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
os: [linux, darwin]
arch: [amd64]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Build
env:
GOOS: linux
GOARCH: amd64
run: go build -v -o "bob-$GOOS-$GOARCH"

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
generate_release_notes: true
files: bob-*
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
mkdir bin
go build -v -o "bin/bob-$GOOS-$GOARCH-$GITHUB_REF_NAME"
- name: Upload
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
name: binaries
path: bin/*

release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download
uses: actions/download-artifact@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
name: binaries
path: bin/

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
generate_release_notes: true
files: bin/*

0 comments on commit 94e54ca

Please sign in to comment.