diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml deleted file mode 100644 index 47307b491213..000000000000 --- a/.github/workflows/docs-deploy.yml +++ /dev/null @@ -1,163 +0,0 @@ -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: - sync-images: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - - - name: Checkout target repository - uses: actions/checkout@v4 - with: - repository: labring/fastgpt-img - token: ${{ secrets.DOCS_IMGS_SYNC_TOKEN }} - path: fastgpt-img - - - name: Sync images - run: | - # Create imgs directory if it doesn't exist - mkdir -p fastgpt-img - - # Copy all images from document/public/imgs to the target repository - cp -r document/public/imgs/* fastgpt-img - - # Navigate to target repository - cd fastgpt-img - - # Configure git - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - # Add, commit and push changes - git add . - if ! git diff --cached --quiet; then - git commit -m "Sync images from FastGPT document at $(date)" - git push - echo "Images synced successfully" - else - echo "No changes to sync" - fi - # Add a new job to generate unified timestamp - generate-timestamp: - needs: sync-images - 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: Rewrite image paths - if: matrix.domain_config.suffix == 'io' - run: | - find document/content/docs -name "*.mdx" -type f | while read file; do - sed -i 's|](/imgs/|](https://cdn.jsdelivr.net/gh/labring/fastgpt-img@main/|g' "$file" - done - - - 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: 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 (CN) - if: matrix.domain_config.suffix == 'cn' - uses: docker/build-push-action@v5 - with: - context: ./document - file: ./document/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 - build-args: | - FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} - - - name: Build and push Docker images (IO) - if: matrix.domain_config.suffix == 'io' - uses: docker/build-push-action@v5 - with: - context: ./document - file: ./document/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 - build-args: | - FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} - - 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 diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml deleted file mode 100644 index 367b9f7fac9f..000000000000 --- a/.github/workflows/docs-preview.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Preview documents -on: - pull_request_target: - paths: - - 'document/**' - workflow_dispatch: - -permissions: - contents: read - packages: write - attestations: write - id-token: write - pull-requests: write - -jobs: - build-images: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get current datetime - id: datetime - run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - - - 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: | - ${{ steps.datetime.outputs.datetime }} - flavor: latest=false - - - 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 }} - build-args: | - FASTGPT_HOME_DOMAIN=https://fastgpt.io - outputs: - tags: ${{ steps.datetime.outputs.datetime }} - - update-images: - needs: build-images - runs-on: ubuntu-24.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - # Add kubeconfig setup step to handle encoding issues - - name: Setup kubeconfig - run: | - mkdir -p $HOME/.kube - echo "${{ secrets.KUBE_CONFIG_CN }}" > $HOME/.kube/config - chmod 600 $HOME/.kube/config - - - name: Update deployment image - run: | - kubectl set image deployment/fastgpt-docs-preview fastgpt-docs-preview=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }} - - - name: Annotate deployment - run: | - kubectl annotate deployment/fastgpt-docs-preview originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }}" --overwrite - - - name: '@finleyge/github-tools' - uses: FinleyGe/github-tools@0.0.1 - id: print-image-label - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Docs Preview:' - body: | - --- - 🚀 **FastGPT Document Preview Ready!** - - 🔗 [👀 Click here to visit preview](https://pueuoharpgcl.sealoshzh.site) diff --git a/.github/workflows/fastgpt-build-image-personal.yml b/.github/workflows/fastgpt-build-image-personal.yml deleted file mode 100644 index b181bf06fe81..000000000000 --- a/.github/workflows/fastgpt-build-image-personal.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Build FastGPT images in Personal warehouse -on: - workflow_dispatch: - push: - paths: - - 'projects/app/**' - - 'packages/**' - branches: - - 'main' - -jobs: - get-vars: - runs-on: ubuntu-24.04 - outputs: - docker_repo: ${{ steps.set_docker_repo.outputs.docker_repo }} - docker_tag: ${{ steps.set_docker_repo.outputs.docker_tag }} - steps: - - name: Set docker repository and tag - id: set_docker_repo - run: | - echo "docker_repo=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "docker_tag=latest" >> $GITHUB_OUTPUT - else - echo "docker_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT - fi - - build-fastgpt-images: - needs: get-vars - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - archs: - - arch: amd64 - runs-on: ubuntu-24.04 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} - if: github.repository != 'labring/FastGPT' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ matrix.archs.arch }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.archs.arch }}-buildx- - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push for ${{ matrix.archs.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/app/Dockerfile - platforms: linux/${{ matrix.archs.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt image - outputs: type=image,"name=${{ needs.get-vars.outputs.docker_repo }}",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ github.sha }}-${{ matrix.archs.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: [get-vars, build-fastgpt-images] - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - echo "Git_Tag=${{ needs.get-vars.outputs.docker_repo }}:${{ needs.get-vars.outputs.docker_tag }}" >> $GITHUB_ENV - echo "Git_Latest=${{ needs.get-vars.outputs.docker_repo }}:latest" >> $GITHUB_ENV - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf '${{ needs.get-vars.outputs.docker_repo }}@sha256:%s ' *) - sleep 5 - done diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index fe6226ab33f0..7cf92d24121c 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -1,4 +1,4 @@ -name: Build FastGPT images +name: Build FastGPT images for Aliyun on: workflow_dispatch: @@ -7,41 +7,42 @@ on: - "projects/app/**" - "packages/**" tags: - - "v*" - + - "*fastgpt*" +env: + IMAGE_NAME: fastgpt # 镜像名(不含 registry 与 namespace) + DOCKERFILE_PATH: projects/app/Dockerfile # Dockerfile 路径(按需修改) + jobs: build-fastgpt-images: permissions: - packages: write contents: read - attestations: write - id-token: write strategy: matrix: sub_routes: - repo: fastgpt - base_url: "" + base_url: "/fastai" - repo: fastgpt-sub-route base_url: "/fastai" - repo: fastgpt-sub-route-gchat base_url: "/gchat" archs: - - arch: amd64 - arch: arm64 runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} steps: - # install env + # 检出代码 - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 + # 设置Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host + # 缓存Docker层 - name: Cache Docker layers uses: actions/cache@v4 with: @@ -50,25 +51,15 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.archs.arch }}-${{ matrix.sub_routes.repo }}-buildx- - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + # 仅登录阿里云容器仓库 - name: Login to Ali Hub uses: docker/login-action@v3 with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} + registry: ${{ secrets.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + # 构建镜像 - name: Build for ${{ matrix.archs.arch }} id: build uses: docker/build-push-action@v6 @@ -81,16 +72,18 @@ jobs: labels: | org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }},${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }},${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true + outputs: type=image,"name=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache + # 导出镜像摘要 - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }} digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/${digest#sha256:}" + # 上传镜像摘要作为工件 - name: Upload digest uses: actions/upload-artifact@v4 with: @@ -101,10 +94,7 @@ jobs: release-fastgpt-images: permissions: - packages: write contents: read - attestations: write - id-token: write needs: build-fastgpt-images strategy: matrix: @@ -114,24 +104,15 @@ jobs: - repo: fastgpt-sub-route-gchat runs-on: ubuntu-24.04 steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + # 登录阿里云容器仓库 - name: Login to Ali Hub uses: docker/login-action@v3 with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} + registry: ${{ secrets.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + # 下载镜像摘要 - name: Download digests uses: actions/download-artifact@v4 with: @@ -139,33 +120,35 @@ jobs: pattern: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-* merge-multiple: true + # 设置Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + # 设置镜像名称和标签 - name: Set image name and tag run: | if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV + echo "Ali_Tag=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV + echo "Ali_Tag=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV + echo "Ali_Latest=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV fi - - name: Create manifest list and push + # 创建镜像清单并推送到阿里云 + - name: Create manifest list and push to Aliyun working-directory: ${{ runner.temp }}/digests run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" + # 基础标签 + TAGS="${Ali_Tag}" + + # 如果不是main分支,还需要推送latest标签 + if [[ "${{ github.ref_name }}" != "main" ]]; then + TAGS="${TAGS} ${Ali_Latest}" + fi + + # 为每个标签创建多架构镜像清单 for TAG in $TAGS; do docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) + $(printf '${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) sleep 5 done diff --git a/.github/workflows/fastgpt-preview-image.yml b/.github/workflows/fastgpt-preview-image.yml deleted file mode 100644 index b17d7570663c..000000000000 --- a/.github/workflows/fastgpt-preview-image.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Preview FastGPT images -on: - pull_request_target: - workflow_dispatch: - -jobs: - preview-fastgpt-images: - permissions: - contents: read - packages: write - attestations: write - id-token: write - pull-requests: write - - runs-on: ubuntu-24.04 - strategy: - matrix: - image: [fastgpt, sandbox, mcp_server] - fail-fast: false # 即使一个镜像构建失败,也继续构建其他镜像 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - driver-opts: network=host - - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.image }} - restore-keys: | - ${{ runner.os }}-buildx-${{ github.sha }}- - ${{ runner.os }}-buildx- - - - name: Login to Aliyun Container Registry - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - - name: Set image config - id: config - run: | - if [[ "${{ matrix.image }}" == "fastgpt" ]]; then - echo "DOCKERFILE=projects/app/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.image }}" == "sandbox" ]]; then - echo "DOCKERFILE=projects/sandbox/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-sandbox-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_sandbox_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.image }}" == "mcp_server" ]]; then - echo "DOCKERFILE=projects/mcp_server/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-mcp_server-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_mcp_server_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - fi - - - name: Build ${{ matrix.image }} image for PR - run: | - docker buildx build \ - -f ${{ steps.config.outputs.DOCKERFILE }} \ - --label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \ - --label "org.opencontainers.image.description=${{ steps.config.outputs.DESCRIPTION }}" \ - --push \ - --cache-from=type=local,src=/tmp/.buildx-cache \ - --cache-to=type=local,dest=/tmp/.buildx-cache \ - -t ${{ steps.config.outputs.DOCKER_REPO_TAGGED }} \ - . - - - name: '@finleyge/github-tools' - uses: FinleyGe/github-tools@0.0.1 - id: print-image-label - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Preview ${{ matrix.image }} Image:' - body: | - ``` - ${{ steps.config.outputs.DOCKER_REPO_TAGGED }} - ``` diff --git a/.github/workflows/fastgpt-test.yaml b/.github/workflows/fastgpt-test.yaml deleted file mode 100644 index 6d41fbb9dc6a..000000000000 --- a/.github/workflows/fastgpt-test.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'FastGPT-Test' -on: - pull_request: - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - - permissions: - # Required to checkout the code - contents: read - # Required to put a comment into the pull-request - pull-requests: write - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - uses: pnpm/action-setup@v4 - with: - version: 10 - - name: 'Install Deps' - run: pnpm install - - name: 'Test' - run: pnpm run test - - name: 'Report Coverage' - # Set if: always() to also generate the report if tests are failing - # Only works if you set `reportOnFailure: true` in your vite config as specified above - if: always() - uses: davelosert/vitest-coverage-report-action@v2 diff --git a/.github/workflows/helm-release.yaml b/.github/workflows/helm-release.yaml deleted file mode 100644 index 9c516992e4bb..000000000000 --- a/.github/workflows/helm-release.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release helm chart - -on: - push: - tags: - - 'v*.*.*' - workflow_dispatch: - -jobs: - helm: - permissions: - packages: write - contents: read - attestations: write - id-token: write - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-tags: true - fetch-depth: 0 - - name: Set output - id: vars - run: echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT - - name: Release Helm - run: | - echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin - export APP_VERSION=${{ steps.vars.outputs.tag }} - export HELM_VERSION=${{ steps.vars.outputs.tag }} - export HELM_REPO=ghcr.io/${{ github.repository_owner }} - helm dependency update deploy/helm/fastgpt - helm package deploy/helm/fastgpt --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin - helm push bin/fastgpt-${HELM_VERSION}-helm.tgz oci://${HELM_REPO} diff --git a/.github/workflows/mcp_server-build-image.yml b/.github/workflows/mcp_server-build-image.yml deleted file mode 100644 index 83b79531c959..000000000000 --- a/.github/workflows/mcp_server-build-image.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Build fastgpt-mcp-server images -on: - workflow_dispatch: - push: - paths: - - 'projects/mcp_server/**' - tags: - - 'v*' -jobs: - build-fastgpt-mcp_server-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - include: - - arch: amd64 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }} - steps: - # install env - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-mcp-server-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-mcp_server-buildx- - - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Build for ${{ matrix.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/mcp_server/Dockerfile - platforms: linux/${{ matrix.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt-mcp_server image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-fastgpt-mcp_server-${{ github.sha }}-${{ matrix.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-mcp_server-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: build-fastgpt-mcp_server-images - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-fastgpt-mcp_server-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - fi - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server@sha256:%s ' *) - sleep 5 - done diff --git a/.github/workflows/sandbox-build-image.yml b/.github/workflows/sandbox-build-image.yml deleted file mode 100644 index 89727bdfd610..000000000000 --- a/.github/workflows/sandbox-build-image.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Build fastgpt-sandbox images -on: - workflow_dispatch: - push: - paths: - - 'projects/sandbox/**' - tags: - - 'v*' -jobs: - build-fastgpt-sandbox-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - include: - - arch: amd64 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }} - steps: - # install env - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-sandbox-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-sandbox-buildx- - - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Build for ${{ matrix.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/sandbox/Dockerfile - platforms: linux/${{ matrix.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt-sandbox image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-fastgpt-sandbox-${{ github.sha }}-${{ matrix.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-sandbox-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: build-fastgpt-sandbox-images - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-fastgpt-sandbox-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - fi - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox@sha256:%s ' *) - sleep 5 - done