瀏覽代碼

CI,docs: Create separate CF pages artifact

The CF pages artifact has no extensions in generated links to avoid the
automatic redirects CF does.
derrod 2 年之前
父節點
當前提交
970585d073
共有 2 個文件被更改,包括 29 次插入1 次删除
  1. 28 1
      .github/workflows/docs.yml
  2. 1 0
      docs/sphinx/conf.py

+ 28 - 1
.github/workflows/docs.yml

@@ -18,6 +18,8 @@ jobs:
       commitHash: ${{ steps.setup.outputs.commitHash }}
       commitBranch: ${{ steps.setup.outputs.commitBranch }}
       fullCommitHash: ${{ steps.setup.outputs.fullCommitHash }}
+    env:
+      BUILD_CF_ARTIFACT: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
     steps:
       - name: Checkout
         uses: actions/checkout@v3
@@ -63,6 +65,23 @@ jobs:
           target_path: '../home/_build'
           pre_build_commands: 'pip install -Iv sphinx==5.1.1'
 
+      - name: Disable link extensions
+        shell: bash
+        if: ${{ env.BUILD_CF_ARTIFACT == 'true' }}
+        run: |
+          SOPT="html_link_suffix = None"
+          ROPT="html_link_suffix = ''"
+          sed -i -e "s/${SOPT}/${ROPT}/g" docs/sphinx/conf.py
+
+      - uses: totaldebug/[email protected]
+        if: ${{ env.BUILD_CF_ARTIFACT == 'true' }}
+        with:
+          sphinx_src: 'docs/sphinx'
+          build_only: True
+          target_branch: 'master'
+          target_path: '../home/_build_cf'
+          pre_build_commands: 'pip install -Iv sphinx==5.1.1'
+
       - uses: actions/upload-artifact@v3
         with:
           name: 'OBS Studio Docs ${{ steps.setup.outputs.commitHash }}'
@@ -70,6 +89,14 @@ jobs:
             ${{ runner.temp }}/_github_home/_build
             !${{ runner.temp }}/_github_home/_build/.doctrees
 
+      - uses: actions/upload-artifact@v3
+        if: ${{ env.BUILD_CF_ARTIFACT == 'true' }}
+        with:
+          name: 'CF Pages ${{ steps.setup.outputs.commitHash }}'
+          path: |
+            ${{ runner.temp }}/_github_home/_build_cf
+            !${{ runner.temp }}/_github_home/_build_cf/.doctrees
+
   deploy:
     runs-on: ubuntu-latest
     needs: docs
@@ -82,7 +109,7 @@ jobs:
     steps:
       - uses: actions/download-artifact@v3
         with:
-          name: 'OBS Studio Docs ${{ needs.docs.outputs.commitHash }}'
+          name: 'CF Pages ${{ needs.docs.outputs.commitHash }}'
           path: docs
 
       - name: Setup redirects

+ 1 - 0
docs/sphinx/conf.py

@@ -143,6 +143,7 @@ html_sidebars = {
     ]
 }
 
+html_link_suffix = None
 
 # -- Options for HTMLHelp output ------------------------------------------