Files
alma-assignments-reporter/.gitea/workflows/ci.yaml
T
Joe Julian 86856abda2
CI / test (push) Successful in 29s
CI / publish (push) Failing after 1m9s
Force ko to publish to the origin registry
2026-03-28 16:59:53 -07:00

60 lines
1.6 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Test
run: go test ./...
- name: Build
run: go build .
publish:
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Configure Registry Auth
env:
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
push_host="$(git remote get-url origin | sed -E 's#^[a-z]+://([^/]+)/.*#\1#')"
mkdir -p "${HOME}/.docker"
auth="$(printf '%s:%s' "${GITHUB_REPOSITORY_OWNER}" "${REGISTRY_PASSWORD}" | base64 -w0)"
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "${push_host}" "${auth}" > "${HOME}/.docker/config.json"
chmod 600 "${HOME}/.docker/config.json"
- name: Install ko
run: GOBIN=/usr/local/bin go install github.com/google/ko@v0.18.0
- name: Build and Push Image
env:
KO_DEFAULTBASEIMAGE: gcr.io/distroless/static-debian12:nonroot
run: |
push_host="$(git remote get-url origin | sed -E 's#^[a-z]+://([^/]+)/.*#\1#')"
export KO_DOCKER_REPO="${push_host}/${GITHUB_REPOSITORY}"
ko build --bare --insecure-registry --sbom=none --tags "main,sha-${GITHUB_SHA}" .