This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
Bump actions/checkout from 3 to 4 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
push: | |
tags: | |
- 'v*.*.*' | |
permissions: | |
contents: write | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Build & install | |
run: | | |
go mod tidy | |
go build -v ./... | |
go install | |
- name: Tests | |
run: | | |
sudo apt-get install -y bats | |
go test -v ./... | |
go vet ./... | |
bats ./bats | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |