Release #4
Workflow file for this run
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: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
- | |
name: Cache Go modules | |
uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- | |
name: Prepare Submodule | |
run: git submodule update --init | |
- | |
name: Tests | |
run: | | |
go test -v ./... | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |