73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
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@v4
|
|
|
|
- name: Set Up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log In To GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- 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
|