Docker registry names must be lowercase, so PUBLIC/gpu-turnstile was rejected by buildx. The workflow now lowercases gitea.repository.
63 lines
1.7 KiB
YAML
63 lines
1.7 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
|
|
|
|
- name: Compute lowercase image name
|
|
id: meta
|
|
run: |
|
|
REPO=git.rambossek.at/$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "image=$REPO" >> "$GITHUB_OUTPUT"
|
|
|
|
- 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: |
|
|
${{ steps.meta.outputs.image }}:${{ gitea.ref_name }}
|
|
${{ steps.meta.outputs.image }}:latest
|