Skip to content

Create master.yml

Create master.yml #1

Workflow file for this run

name: Build and Release
on:
push:
branches: [ master ]
tags: [ '*.*.*' ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: '^1.17.0'
- name: Linters
if: matrix.os == 'ubuntu-latest'
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.38.0
golangci-lint run
- name: Build
run: |
go build
- name: Test non-Ubuntu platforms
if: matrix.os != 'ubuntu-latest'
run: |
go test -race -shuffle=on
- name: Test and create coverage (Ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
go test -race -shuffle=on -coverprofile=coverage.txt -covermode=atomic
github-publish:
# Only publish if all other jobs succeed
needs:
- test
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: '^1.20.0'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}