ci: dev/stage/main branch build pipeline for custom Gitea image
Build & Push Gitea image / build-push (push) Failing after 1m50s
Build & Push Gitea image / build-push (push) Failing after 1m50s
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>
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
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:
|
||||
- feat/workflow-step-events
|
||||
- dev
|
||||
- stage
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -30,30 +38,52 @@ jobs:
|
||||
- name: Configure Docker for Artifact Registry
|
||||
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
|
||||
|
||||
- name: Set image tag
|
||||
- name: Compute image tags
|
||||
id: tag
|
||||
run: |
|
||||
REGISTRY="us-central1-docker.pkg.dev/neuron-785695/neuron-ci/gitea"
|
||||
SHA="${GITHUB_SHA:0:8}"
|
||||
echo "tag=us-central1-docker.pkg.dev/neuron-785695/neuron-ci/gitea:${SHA}" >> "$GITHUB_OUTPUT"
|
||||
echo "latest=us-central1-docker.pkg.dev/neuron-785695/neuron-ci/gitea:latest" >> "$GITHUB_OUTPUT"
|
||||
echo "SHA=${SHA}" >> "$GITHUB_OUTPUT"
|
||||
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" \
|
||||
-t "${{ steps.tag.outputs.tag }}" \
|
||||
-t "${{ steps.tag.outputs.latest }}" \
|
||||
$TAGS \
|
||||
.
|
||||
|
||||
- name: Push Gitea image
|
||||
run: |
|
||||
docker push "${{ steps.tag.outputs.tag }}"
|
||||
docker push "${{ steps.tag.outputs.latest }}"
|
||||
echo "Pushed gitea:${{ steps.tag.outputs.SHA }} and :latest"
|
||||
for t in ${{ steps.tag.outputs.tags }}; do
|
||||
docker push "$t"
|
||||
echo "Pushed: $t"
|
||||
done
|
||||
|
||||
- name: Output image tag
|
||||
run: |
|
||||
echo "::notice title=Image pushed::${{ steps.tag.outputs.tag }}"
|
||||
echo "Update deployment.yaml image to: ${{ steps.tag.outputs.tag }}"
|
||||
- name: Output
|
||||
run: echo "::notice title=Image::${{ steps.tag.outputs.primary }}"
|
||||
|
||||
Reference in New Issue
Block a user