nurse/.forgejo/workflows/go.yaml
Forgejo Actions 9382d3bd55
Some checks failed
Go build / build (push) Failing after 1m32s
chore(deps): update golangci/golangci-lint-action action to v4
2024-02-10 03:34:20 +00:00

77 lines
2.1 KiB
YAML

name: Go build
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
lfs: 'true'
fetch-tags: 'true'
- name: Setup Go 1.21.x
uses: actions/setup-go@v5
with:
# Semantic version range syntax or exact version of Go
go-version: '1.21.x'
- name: Install ko
run: |
set -e
arch=$(uname -m)
case $arch in
aarch64)
arch="arm64"
;;
esac
curl -L $(curl -L -s https://api.github.com/repos/ko-build/ko/releases/latest | jq -r "[.assets[] | select(.name | endswith(\"Linux_${arch}.tar.gz\"))][0].browser_download_url") | tar -C /tmp -xzf -
mv /tmp/ko /usr/local/bin
ko version
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
- name: Install Task
uses: arduino/setup-task@v1
- name: Run tests
run: |
go install gotest.tools/gotestsum@latest
gotestsum --junitfile out/results.xml --format pkgname-and-test-fails -- -race -shuffle=on ./...
- name: Snapshot release
uses: goreleaser/goreleaser-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean --snapshot
- name: Login to Docker registry
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: docker/login-action@v3
with:
registry: code.icb4dc0.de
username: ${{ github.repository_owner }}
password: ${{ secrets.RELEASE_TOKEN }}
- name: Release
uses: goreleaser/goreleaser-action@v5
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ""
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}