Files
alma-assignments-reporter/.gitea/workflows/ci.yaml
T
Joe Julian 5f16410960
CI / test (push) Successful in 30s
CI / publish (push) Failing after 27s
Add container publishing and env-based runtime
2026-03-28 15:36:52 -07:00

56 lines
1.4 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: Install Docker CLI
run: |
apt-get update
apt-get install -y docker.io
- name: Login to Gitea Registry
env:
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
registry_host="${GITHUB_SERVER_URL#http://}"
registry_host="${registry_host#https://}"
printf '%s' "${REGISTRY_PASSWORD}" | docker login "${registry_host}" -u "${GITHUB_REPOSITORY_OWNER}" --password-stdin
- name: Build and Push Image
run: |
registry_host="${GITHUB_SERVER_URL#http://}"
registry_host="${registry_host#https://}"
image="${registry_host}/${GITHUB_REPOSITORY}"
docker build -t "${image}:main" -t "${image}:sha-${GITHUB_SHA}" .
docker push "${image}:main"
docker push "${image}:sha-${GITHUB_SHA}"