ci: fix staging build step, use build_release_images.sh (same as production)
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Production Runtime Images (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 39h49m43s
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Production Runtime Images (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 39h49m43s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user