Gitea authenticates registry pushes by token alone; a single REGISTRY_TOKEN secret suffices.
57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.23"
|
|
- run: go vet ./...
|
|
- run: go test -race ./...
|
|
- name: golangci-lint
|
|
run: |
|
|
if command -v golangci-lint >/dev/null 2>&1; then
|
|
golangci-lint run
|
|
else
|
|
echo "golangci-lint not available in runner image, skipping"
|
|
fi
|
|
|
|
# Release images are built only from version tags (vX.Y.Z).
|
|
docker:
|
|
if: gitea.ref_type == 'tag'
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check tag is semantic version
|
|
run: |
|
|
if ! echo "${{ gitea.ref_name }}" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
echo "tag '${{ gitea.ref_name }}' is not a vX.Y.Z semantic version" >&2
|
|
exit 1
|
|
fi
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: git.rambossek.at
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
build-args: |
|
|
VERSION=${{ gitea.ref_name }}
|
|
tags: |
|
|
git.rambossek.at/${{ gitea.repository }}:${{ gitea.ref_name }}
|
|
git.rambossek.at/${{ gitea.repository }}:latest
|