Skip to content

improvement: Rename overwrite flag to force. #47

improvement: Rename overwrite flag to force.

improvement: Rename overwrite flag to force. #47

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
tags:
- v*
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Print Github Build Environment
run: echo "$GITHUB_VARS"
shell: bash
env:
GITHUB_VARS: ${{ toJson(github) }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Verify dependencies
run: go mod verify
- name: Vet
run: go vet $(go list ./... | grep -v /vendor/)
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck $(go list ./... | grep -v /vendor/)
- name: Install golint
run: go install golang.org/x/lint/golint@latest
- name: Run golint
run: golint $(go list ./... | grep -v /vendor/)
- name: Compile
run: go build -v ./...
- name: Test
run: go test -v ./...
release:
runs-on: ubuntu-latest
needs:
- test
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Print Github Build Environment
run: echo "$GITHUB_VARS"
shell: bash
env:
GITHUB_VARS: ${{ toJson(github) }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Build Darwin amd64
run: GOOS=darwin GOARCH=amd64 go build -v -ldflags="-X github.com/${{ github.repository }}/version.version=${{ github.ref_name }}" -o ./bin/${{ github.event.repository.name }}-amd64-darwin
- name: Build Darwin arm64
run: GOOS=darwin GOARCH=arm64 go build -v -ldflags="-X github.com/${{ github.repository }}/version.version=${{ github.ref_name }}" -o ./bin/${{ github.event.repository.name }}-arm64-darwin
- name: Build Linux amd64
run: GOOS=linux GOARCH=amd64 go build -v -ldflags="-X github.com/${{ github.repository }}/version.version=${{ github.ref_name }}" -o ./bin/${{ github.event.repository.name }}-amd64-linux
- name: Build Linux arm64
run: GOOS=linux GOARCH=arm64 go build -v -ldflags="-X github.com/${{ github.repository }}/version.version=${{ github.ref_name }}" -o ./bin/${{ github.event.repository.name }}-arm64-linux
- name: Build Windows amd64
run: GOOS=windows GOARCH=amd64 go build -v -ldflags="-X github.com/${{ github.repository }}/version.version=${{ github.ref_name }}" -o ./bin/${{ github.event.repository.name }}-amd64-windows.exe
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./bin/${{ github.event.repository.name }}-amd64-darwin
./bin/${{ github.event.repository.name }}-arm64-darwin
./bin/${{ github.event.repository.name }}-amd64-linux
./bin/${{ github.event.repository.name }}-arm64-linux
./bin/${{ github.event.repository.name }}-amd64-windows.exe