From 86988e31d97db966d602d923fe425622a4103550 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Tue, 8 Apr 2025 13:50:36 +0800 Subject: [PATCH] feat: Add docs deploy to cf (#4475) * perf: remove loading ui * feat: config chat file expired time * 494 doc * feat: Add docs deploy to cf --- .github/workflows/docs-deploy-cf.yml | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/docs-deploy-cf.yml diff --git a/.github/workflows/docs-deploy-cf.yml b/.github/workflows/docs-deploy-cf.yml new file mode 100644 index 000000000..26627850c --- /dev/null +++ b/.github/workflows/docs-deploy-cf.yml @@ -0,0 +1,71 @@ +name: Deploy doc image to cf + +on: + workflow_dispatch: + push: + paths: + - 'docSite/**' + branches: + - 'main' + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains jobs "deploy-production" + deploy-production: + # The environment this job references + environment: + name: Production + url: ${{ steps.vercel-action.outputs.preview-url }} + + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + + # Job outputs + outputs: + docs: ${{ steps.filter.outputs.docs }} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Step 1 - Checks-out your repository under $GITHUB_WORKSPACE + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive # Fetch submodules + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + # Step 2 Detect changes to Docs Content + - name: Detect changes in doc content + uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + docs: + - 'docSite/content/docs/**' + base: main + + - name: Add cdn for images + run: | + sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/zh-cn/docs) + + # Step 3 - Install Hugo (specific version) + - name: Install Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.117.0' + extended: true + + # Step 4 - Builds the site using Hugo + - name: Build + run: cd docSite && hugo mod get -u github.com/colinwilson/lotusdocs@6d0568e && hugo -v --minify + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docSite/public