chore: cleanup, add docs, refactor some quirks and prepare release
All checks were successful
Go build / build (push) Successful in 5m19s

This commit is contained in:
Peter 2023-12-04 16:59:10 +01:00
parent 0faff1d481
commit 3139e11fb9
No known key found for this signature in database
4 changed files with 29 additions and 7 deletions

View file

@ -3,6 +3,8 @@ on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
@ -34,16 +36,29 @@ jobs:
go install gotest.tools/gotestsum@latest
gotestsum --junitfile out/results.xml --format pkgname-and-test-fails -- -race -shuffle=on ./...
- uses: goreleaser/goreleaser-action@v5
- name: Snapshot release
uses: goreleaser/goreleaser-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean --snapshot
- uses: goreleaser/goreleaser-action@v5
- 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 }}

View file

@ -1,8 +1,5 @@
name: Renovate
on:
push:
branches:
- main
schedule:
- cron: '33 3 * * *'

View file

@ -23,10 +23,11 @@ changelog:
- '^docs:'
- '^test:'
force_token: gitea
release:
gitea:
owner: prskr
repo: nurse
name: nurse
ids:
- nurse
mode: replace
@ -42,3 +43,7 @@ dockers:
- code.icb4dc0.de/prskr/nurse:{{ .Major }}
- code.icb4dc0.de/prskr/nurse:{{ .ShortCommit}}
dockerfile: deployments/Dockerfile
gitea_urls:
api: https://code.icb4dc0.de/api/v1
download: https://code.icb4dc0.de

View file

@ -10,7 +10,12 @@ import (
// It returns the last error encountered during the attempts.
// If the context is canceled, it returns the context error (if there is no previous error),
// or the joined error of the last error and the context error (otherwise).
func Retry(ctx context.Context, numberOfAttempts uint, attemptTimeout time.Duration, f func(ctx context.Context, attempt int) error) (lastErr error) {
func Retry(
ctx context.Context,
numberOfAttempts uint,
attemptTimeout time.Duration,
f func(ctx context.Context, attempt int) error,
) (lastErr error) {
baseCtx, baseCancel := context.WithTimeout(ctx, time.Duration(numberOfAttempts)*attemptTimeout)
defer baseCancel()