nurse/.forgejo/workflows/go.yaml
Peter Kurfer 18791042db
All checks were successful
Go build / build (push) Successful in 4m20s
chore: upgrade to Go 1.22
2024-04-11 17:23:47 +02: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.22.x
uses: actions/setup-go@v5
with:
# Semantic version range syntax or exact version of Go
go-version: '1.22.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 }}