diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index f8e01711b..6de8df1cd 100755 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -327,58 +327,15 @@ jobs: set -eu apt-get update -qq && apt-get install -y -qq openssh-client >/dev/null 2>&1 echo "openssh-client installed" - - name: Build and push all images to Gitea Registry - shell: bash + shell: sh env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | set -eu - REGISTRY="git.xiaoxiajianji.com/xiaoxia/xiaoxia-saas" - TAG="${GITHUB_SHA}" - CACHE_BRANCH="${GITHUB_REF_NAME//\//-}" - - printf '%s' "${REGISTRY_TOKEN}" | docker login git.xiaoxiajianji.com -u xiaoxia --password-stdin - docker buildx use default 2>/dev/null || true - - echo "=== Building API image ===" - docker buildx build \ - --cache-from "type=registry,ref=${REGISTRY}/api-cache:${CACHE_BRANCH},ignore-error=true" \ - --cache-to "type=registry,ref=${REGISTRY}/api-cache:${CACHE_BRANCH},mode=max" \ - -f infra/docker/api.Dockerfile \ - -t "${REGISTRY}/xiaoxia-saas-api:${TAG}" \ - --push \ - . - - echo "=== Building Worker image ===" - docker buildx build \ - --cache-from "type=registry,ref=${REGISTRY}/worker-cache:${CACHE_BRANCH},ignore-error=true" \ - --cache-to "type=registry,ref=${REGISTRY}/worker-cache:${CACHE_BRANCH},mode=max" \ - -f infra/docker/worker.Dockerfile \ - -t "${REGISTRY}/xiaoxia-saas-worker:${TAG}" \ - --push \ - . - - echo "=== Building web frontend ===" - docker run --rm \ - -v "$PWD:/workspace" \ - -w /workspace/apps/web \ - docker.m.daocloud.io/library/node:20 \ - sh -lc 'npm ci && npm run build' - test -f apps/web/dist/index.html - - echo "=== Building Web image ===" - docker buildx build \ - --cache-from "type=registry,ref=${REGISTRY}/web-cache:${CACHE_BRANCH},ignore-error=true" \ - --cache-to "type=registry,ref=${REGISTRY}/web-cache:${CACHE_BRANCH},mode=max" \ - -f infra/docker/web-artifact.Dockerfile \ - --build-arg NGINX_CONF=infra/docker/nginx-production.conf \ - -t "${REGISTRY}/xiaoxia-saas-web:${TAG}" \ - --push \ - . - - echo "=== All images pushed ===" - docker images | grep "${GITHUB_SHA}" || true + chmod +x scripts/build_release_images.sh + ALLOW_SHARED_PRODUCTION_BUILD_HOST=true REGISTRY_TOKEN="${REGISTRY_TOKEN}" \ + scripts/build_release_images.sh "${GITHUB_SHA}" - name: Deploy staging via Registry pull shell: sh