refactor(ci): merge frontend publish workflow
This commit is contained in:
parent
fa64d666b8
commit
69802dace7
18
.github/workflows/build-push-ghcr-image.yml
vendored
18
.github/workflows/build-push-ghcr-image.yml
vendored
@ -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:
|
||||
|
||||
74
.github/workflows/publish-frontend-image.yml
vendored
74
.github/workflows/publish-frontend-image.yml
vendored
@ -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
|
||||
Loading…
Reference in New Issue
Block a user