nurse/.forgejo/workflows/go.yaml

78 lines
2.1 KiB
YAML
Raw Permalink Normal View History

2023-11-29 21:01:37 +00:00
name: Go build
on:
push:
branches:
- main
tags:
- "*"
2023-11-29 21:01:37 +00:00
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2023-11-29 21:01:37 +00:00
with:
fetch-depth: '0'
lfs: 'true'
fetch-tags: 'true'
2024-04-10 19:21:37 +00:00
- name: Setup Go 1.22.x
uses: actions/setup-go@v5
2023-11-29 21:01:37 +00:00
with:
# Semantic version range syntax or exact version of Go
2024-04-10 19:21:37 +00:00
go-version: '1.22.x'
2023-12-12 19:23:27 +00:00
- 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
2023-11-29 21:01:37 +00:00
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
2023-11-29 21:01:37 +00:00
- name: Install Task
uses: arduino/setup-task@v1
2023-11-29 21:01:37 +00:00
- 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@v6
2023-11-29 21:01:37 +00:00
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@v6
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ""
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}