Files
wx-win-agent/.gitea/workflows/build-web-image.yml
T
rogee 13c31fc902
Build web service image / build (push) Successful in 1m53s
feat: add remote control plane and whitelist reads
2026-09-12 09:46:05 +08:00

63 lines
1.6 KiB
YAML

---
name: Build web service image
"on":
push:
branches:
- main
tags:
- "v*"
paths:
- "control-plane/**"
- ".gitea/workflows/build-web-image.yml"
workflow_dispatch:
env:
REGISTRY: git.ipao.vip
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Log in to Gitea container registry
env:
REGISTRY_USERNAME: ${{ github.repository_owner }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
set -eu
if [ -z "$REGISTRY_TOKEN" ]; then
echo "REGISTRY_TOKEN is not configured" >&2
exit 1
fi
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY" \
--username "$REGISTRY_USERNAME" --password-stdin
- name: Build and push image
shell: bash
run: |
set -euo pipefail
image="$REGISTRY/$IMAGE_NAME"
sha_tag="sha-${GITHUB_SHA:0:12}"
docker build \
--file control-plane/Dockerfile \
--tag "$image:$sha_tag" \
control-plane
docker push "$image:$sha_tag"
case "$GITHUB_REF" in
refs/heads/main)
docker tag "$image:$sha_tag" "$image:latest"
docker push "$image:latest"
;;
refs/tags/v*)
release_tag="${GITHUB_REF#refs/tags/}"
docker tag "$image:$sha_tag" "$image:$release_tag"
docker push "$image:$release_tag"
;;
esac