mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 04:32:50 +00:00
Some checks are pending
Document deploy / generate-timestamp (push) Waiting to run
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Blocked by required conditions
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
124 lines
4.1 KiB
YAML
124 lines
4.1 KiB
YAML
name: Document deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'document/**'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
# Add a new job to generate unified timestamp
|
|
generate-timestamp:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
datetime: ${{ steps.datetime.outputs.datetime }}
|
|
steps:
|
|
- name: Get current datetime
|
|
id: datetime
|
|
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
|
|
|
|
build-images:
|
|
needs: generate-timestamp
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
domain_config:
|
|
- domain: 'https://fastgpt.io'
|
|
suffix: 'io'
|
|
- domain: 'https://fastgpt.cn'
|
|
suffix: 'cn'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
# list of Docker images to use as base name for tags
|
|
images: |
|
|
${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs
|
|
tags: |
|
|
${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}
|
|
flavor: latest=false
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache-${{ matrix.domain_config.suffix }}
|
|
key: ${{ runner.os }}-docs-buildx-${{ matrix.domain_config.suffix }}-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-docs-buildx-${{ matrix.domain_config.suffix }}-
|
|
|
|
- name: Login to Aliyun
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.cn-hangzhou.aliyuncs.com
|
|
username: ${{ secrets.ALI_HUB_USERNAME }}
|
|
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
|
|
|
- name: Build and push Docker images
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./document
|
|
file: ./document/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
# 使用本地缓存替代 GHA 缓存
|
|
cache-from: type=local,src=/tmp/.buildx-cache-${{ matrix.domain_config.suffix }}
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-${{ matrix.domain_config.suffix }}
|
|
build-args: |
|
|
NEXT_PUBLIC_SEARCH_APPKEY=c4708d48f2de6ac5d2f0f443979ef92a
|
|
NEXT_PUBLIC_SEARCH_APPID=HZAF4C2T88
|
|
FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }}
|
|
${{ matrix.domain_config.suffix == 'cn' && 'SEARCH_APPWRITEKEY=${{ secrets.SEARCH_APPWRITEKEY }}' || '' }}
|
|
|
|
update-images:
|
|
needs: [generate-timestamp, build-images]
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
matrix:
|
|
domain_config:
|
|
- domain: 'https://fastgpt.io'
|
|
suffix: 'io'
|
|
deployment: 'fastgpt-docs'
|
|
kube_config: 'KUBE_CONFIG_IO'
|
|
- domain: 'https://fastgpt.cn'
|
|
suffix: 'cn'
|
|
deployment: 'fastgpt-docs'
|
|
kube_config: 'KUBE_CONFIG_CN'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Add kubeconfig setup step to handle encoding issues
|
|
- name: Setup kubeconfig
|
|
run: |
|
|
mkdir -p $HOME/.kube
|
|
echo "${{ secrets[matrix.domain_config.kube_config] }}" > $HOME/.kube/config
|
|
chmod 600 $HOME/.kube/config
|
|
|
|
- name: Update deployment image
|
|
run: |
|
|
kubectl set image deployment/${{ matrix.domain_config.deployment }} ${{ matrix.domain_config.deployment }}=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}
|
|
|
|
- name: Annotate deployment
|
|
run: |
|
|
kubectl annotate deployment/${{ matrix.domain_config.deployment }} originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}" --overwrite
|