Files
gitea/.gitea/workflows/build-push.yaml
T
will.anderson 4e929ad814
Build & Push Gitea image / build-push (push) Failing after 1m50s
ci: dev/stage/main branch build pipeline for custom Gitea image
Build and push to Artifact Registry on merge to dev/stage/main:
  dev   → gitea:dev
  stage → gitea:stage
  main  → gitea:latest + gitea:<sha>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 18:47:04 -05:00

90 lines
2.4 KiB
YAML

name: Build & Push Gitea image
# Builds and pushes a custom Gitea image to Artifact Registry.
# Branch → image tag mapping:
# dev → gitea:dev (inner dev loop)
# stage → gitea:stage (staging verification)
# main → gitea:latest + gitea:<sha> (production)
on:
push:
branches:
- dev
- stage
- main
workflow_dispatch:
jobs:
build-push:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: neuron-785695
- name: Configure Docker for Artifact Registry
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Compute image tags
id: tag
run: |
REGISTRY="us-central1-docker.pkg.dev/neuron-785695/neuron-ci/gitea"
SHA="${GITHUB_SHA:0:8}"
BRANCH="${GITEA_REF_NAME:-${GITHUB_REF_NAME}}"
case "$BRANCH" in
main)
TAGS="${REGISTRY}:latest ${REGISTRY}:${SHA}"
ENV_TAG="latest"
;;
stage)
TAGS="${REGISTRY}:stage ${REGISTRY}:stage-${SHA}"
ENV_TAG="stage"
;;
dev)
TAGS="${REGISTRY}:dev ${REGISTRY}:dev-${SHA}"
ENV_TAG="dev"
;;
*)
TAGS="${REGISTRY}:${SHA}"
ENV_TAG="${SHA}"
;;
esac
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
echo "primary=${REGISTRY}:${ENV_TAG}" >> "$GITHUB_OUTPUT"
echo "sha=${SHA}" >> "$GITHUB_OUTPUT"
- name: Build Gitea image
run: |
TAGS=""
for t in ${{ steps.tag.outputs.tags }}; do
TAGS="$TAGS -t $t"
done
docker build \
--build-arg GITEA_VERSION="neuron-$(git rev-parse --short HEAD)" \
--build-arg TAGS="sqlite sqlite_unlock_notify" \
$TAGS \
.
- name: Push Gitea image
run: |
for t in ${{ steps.tag.outputs.tags }}; do
docker push "$t"
echo "Pushed: $t"
done
- name: Output
run: echo "::notice title=Image::${{ steps.tag.outputs.primary }}"