|
| 1 | +name: Deploy documentation |
| 2 | + |
| 3 | +on: |
| 4 | + # If specified, the workflow will be triggered automatically once you push to the `main` branch. |
| 5 | + # Replace `main` with your branch’s name |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - dev |
| 9 | + paths: |
| 10 | + - 'docs/**' |
| 11 | + - 'docs_zh/**' |
| 12 | + - 'docs_en/**' |
| 13 | + - '.github/workflows/doc-publish.yml' |
| 14 | + |
| 15 | + # Specify to run a workflow manually from the Actions tab on GitHub |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +# Gives the workflow permissions to clone the repo and create a page deployment |
| 19 | +permissions: |
| 20 | + id-token: write |
| 21 | + pages: write |
| 22 | + |
| 23 | +env: |
| 24 | + # Name of module and id separated by a slash |
| 25 | + INSTANCE: docs/docs |
| 26 | + INSTANCE_NAME: docs |
| 27 | + IS_GROUP: true |
| 28 | + # Replace HI with the ID of the instance in capital letters |
| 29 | + ARTIFACT: webHelpDOCS2-all.zip |
| 30 | + # Writerside docker image version |
| 31 | + # see https://www.jetbrains.com/help/writerside/deploy-docs-to-github-pages.html |
| 32 | + DOCKER_VERSION: '2025.04.8412' |
| 33 | + |
| 34 | +jobs: |
| 35 | + build: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + outputs: |
| 38 | + config_json: ${{ steps.output-config-json.outputs.config_json }} |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Build Writerside docs using Docker |
| 45 | + uses: JetBrains/writerside-github-action@v4 |
| 46 | + with: |
| 47 | + instance: ${{ env.INSTANCE }} |
| 48 | + artifact: ${{ env.ARTIFACT }} |
| 49 | + docker-version: ${{ env.DOCKER_VERSION }} |
| 50 | + is-group: ${{ env.IS_GROUP }} |
| 51 | + |
| 52 | + - name: Upload documentation |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: docs |
| 56 | + path: | |
| 57 | + artifacts/${{ env.ARTIFACT }} |
| 58 | + artifacts/report.json |
| 59 | + retention-days: 7 |
| 60 | + |
| 61 | + - name: Upload documentation test reports |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + if: ${{ always() }} |
| 64 | + with: |
| 65 | + name: 'report.json' |
| 66 | + path: | |
| 67 | + artifacts/report.json |
| 68 | + retention-days: 7 |
| 69 | + |
| 70 | + - name: Unzip artifact |
| 71 | + run: unzip -O UTF-8 -qq artifacts/${{ env.ARTIFACT }} -d dir |
| 72 | + |
| 73 | + - name: Output documentation config.json |
| 74 | + id: output-config-json |
| 75 | + run: | |
| 76 | + echo "config_json=$(cat dir/config.json)" >> $GITHUB_OUTPUT |
| 77 | +
|
| 78 | + # Add the job below and artifacts/report.json on Upload documentation step above if you want to fail the build when documentation contains errors |
| 79 | + test: |
| 80 | + # Requires build job results |
| 81 | + needs: build |
| 82 | + runs-on: ubuntu-latest |
| 83 | + |
| 84 | + steps: |
| 85 | + - name: Download artifacts |
| 86 | + uses: actions/download-artifact@v4 |
| 87 | + with: |
| 88 | + name: docs |
| 89 | + path: artifacts |
| 90 | + |
| 91 | + - name: Test documentation |
| 92 | + uses: JetBrains/writerside-checker-action@v1 |
| 93 | + with: |
| 94 | + instance: ${{ env.INSTANCE }} |
| 95 | + is-group: ${{ env.IS_GROUP }} |
| 96 | + |
| 97 | + deploy: |
| 98 | + environment: |
| 99 | + name: github-pages |
| 100 | + url: ${{ steps.deployment.outputs.page_url }} |
| 101 | + # Requires the build job results |
| 102 | + needs: test |
| 103 | + runs-on: ubuntu-latest |
| 104 | + steps: |
| 105 | + - name: Download artifact |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: docs |
| 109 | + |
| 110 | + - name: Unzip artifact |
| 111 | + run: unzip -O UTF-8 -qq artifacts/${{ env.ARTIFACT }} -d dir |
| 112 | + |
| 113 | + - name: Setup Pages |
| 114 | + uses: actions/configure-pages@v5 |
| 115 | + |
| 116 | + - name: Upload artifact |
| 117 | + uses: actions/upload-pages-artifact@v3 |
| 118 | + with: |
| 119 | + path: dir |
| 120 | + |
| 121 | + - name: Deploy to GitHub Pages |
| 122 | + id: deployment |
| 123 | + uses: actions/deploy-pages@v4 |
0 commit comments