Skip to content

Commit

Permalink
ci: github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Bulgakov committed Oct 17, 2023
1 parent 10ec202 commit 6fbc0f3
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build
on: [ push, pull_request ]
jobs:
build:
strategy:
matrix:
go-version: [ 1.21.x ]
os: [ ubuntu-latest, macos-latest ]
include:
- os: ubuntu-latest
goos: linux
- os: macos-latest
goos: darwin

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Test
run: go test -v ./...
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: amd64
CGO_ENABLED: '0'
run: go build -a -ldflags='-w -s -extldflags "-static"' -o ./build/tagrelease-$GOOS-$GOARCH
- name: upload build artifact
uses: actions/upload-artifact@v3
with:
name: binaries
path: build/*

release:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: download build artifacts
uses: actions/download-artifact@v3
with:
name: binaries
- name: list build artifacts
run: ls -l
- name: publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/*

0 comments on commit 6fbc0f3

Please sign in to comment.