From 69802dace70de612068b84b8d45d84aafb35cb37 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Thu, 2 Apr 2026 18:08:43 +0800 Subject: [PATCH] refactor(ci): merge frontend publish workflow --- .github/workflows/build-push-ghcr-image.yml | 18 +++++ .github/workflows/publish-frontend-image.yml | 74 -------------------- 2 files changed, 18 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/publish-frontend-image.yml diff --git a/.github/workflows/build-push-ghcr-image.yml b/.github/workflows/build-push-ghcr-image.yml index 067270c..d292b56 100644 --- a/.github/workflows/build-push-ghcr-image.yml +++ b/.github/workflows/build-push-ghcr-image.yml @@ -1,6 +1,24 @@ name: Build And Push GHCR Image on: + push: + branches: + - main + paths: + - '.github/workflows/build-push-ghcr-image.yml' + - 'Dockerfile' + - 'package.json' + - 'yarn.lock' + - 'scripts/github-actions/build-and-push-frontend-image.sh' + - 'scripts/github-actions/compute-frontend-release-metadata.sh' + - 'scripts/github-actions/render-frontend-build-args.sh' + - 'scripts/github-actions/prepare-frontend-build-context.sh' + - 'scripts/prebuild.sh' + - 'contentlayer.config.ts' + - 'next.config.js' + - 'next.config.mjs' + - 'src/**' + - 'public/**' workflow_call: inputs: image_tag: diff --git a/.github/workflows/publish-frontend-image.yml b/.github/workflows/publish-frontend-image.yml deleted file mode 100644 index b71512b..0000000 --- a/.github/workflows/publish-frontend-image.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Publish Frontend Image - -on: - push: - branches: - - main - paths: - - '.github/workflows/publish-frontend-image.yml' - - 'Dockerfile' - - 'package.json' - - 'yarn.lock' - - 'scripts/github-actions/build-and-push-frontend-image.sh' - - 'scripts/github-actions/compute-frontend-release-metadata.sh' - - 'scripts/github-actions/render-frontend-build-args.sh' - - 'scripts/github-actions/prepare-frontend-build-context.sh' - - 'scripts/prebuild.sh' - - 'contentlayer.config.ts' - - 'next.config.js' - - 'next.config.mjs' - - 'src/**' - - 'public/**' - workflow_dispatch: - inputs: - image_tag: - description: Optional image tag. Defaults to the triggering commit SHA. - required: false - type: string - push_latest: - description: Also publish the `latest` tag. - required: false - default: false - type: boolean - -permissions: - contents: read - packages: write - -jobs: - publish-image: - runs-on: ubuntu-latest - env: - PRIMARY_DOMAIN: console.svc.plus - NEXT_PUBLIC_RUNTIME_ENVIRONMENT: prod - NEXT_PUBLIC_RUNTIME_REGION: cn - steps: - - name: Check Out Repository - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - - - name: Set Up Docker Buildx - run: | - docker buildx create --name console-builder --use >/dev/null 2>&1 || docker buildx use console-builder - docker buildx inspect --bootstrap - - - name: Log In To GHCR - env: - GHCR_USERNAME: ${{ github.actor }} - GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "${GHCR_TOKEN}" | docker login ghcr.io -u "${GHCR_USERNAME}" --password-stdin - - - name: Compute Image Metadata - id: metadata - env: - IMAGE_TAG_INPUT: ${{ inputs.image_tag }} - run: | - bash scripts/github-actions/compute-frontend-release-metadata.sh "${IMAGE_TAG_INPUT}" - - - name: Publish Frontend Image - env: - IMAGE_REF: ${{ steps.metadata.outputs.image_ref }} - IMAGE_LATEST_REF: ${{ steps.metadata.outputs.image_latest_ref }} - PUSH_LATEST: ${{ github.event_name == 'push' && 'true' || inputs.push_latest }} - run: | - bash scripts/github-actions/build-and-push-frontend-image.sh