|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - main |
| 5 | + # Specify to run a workflow manually from the Actions tab on GitHub |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write |
| 10 | + pages: write |
| 11 | + |
| 12 | +env: |
| 13 | + INSTANCE: Writerside/${{ github.event.repository.name }} |
| 14 | + ARTIFACT: webHelp${{ github.event.repository.name }}2-all.zip |
| 15 | + DOCKER_VERSION: 232.10165.1 |
| 16 | + ALGOLIA_ARTIFACT: algolia-indexes-${{ github.event.repository.name }}.zip |
| 17 | + ALGOLIA_APP_NAME: Deepkit GraphQL |
| 18 | + ALGOLIA_INDEX_NAME: docs |
| 19 | + ALGOLIA_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} |
| 20 | + CONFIG_JSON_PRODUCT: ${{ github.event.repository.name }} |
| 21 | + CONFIG_JSON_VERSION: 1.0 |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v3 |
| 30 | + |
| 31 | + - name: Build Writerside docs using Docker |
| 32 | + uses: JetBrains/writerside-github-action@v4 |
| 33 | + with: |
| 34 | + instance: ${{ env.INSTANCE }} |
| 35 | + artifact: ${{ env.ARTIFACT }} |
| 36 | + docker-version: ${{ env.DOCKER_VERSION }} |
| 37 | + |
| 38 | + - name: Upload documentation |
| 39 | + uses: actions/upload-artifact@v3 |
| 40 | + with: |
| 41 | + name: docs |
| 42 | + path: | |
| 43 | + artifacts/${{ env.ARTIFACT }} |
| 44 | + artifacts/report.json |
| 45 | + retention-days: 7 |
| 46 | + |
| 47 | + - name: Upload algolia-indexes |
| 48 | + uses: actions/upload-artifact@v3 |
| 49 | + with: |
| 50 | + name: algolia-indexes |
| 51 | + path: artifacts/${{ env.ALGOLIA_ARTIFACT }} |
| 52 | + retention-days: 7 |
| 53 | + |
| 54 | + test: |
| 55 | + needs: build |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - name: Download artifacts |
| 59 | + uses: actions/download-artifact@v1 |
| 60 | + with: |
| 61 | + name: docs |
| 62 | + path: artifacts |
| 63 | + |
| 64 | + - name: Test documentation |
| 65 | + uses: JetBrains/writerside-checker-action@v1 |
| 66 | + with: |
| 67 | + instance: ${{ env.INSTANCE }} |
| 68 | + |
| 69 | + deploy: |
| 70 | + environment: |
| 71 | + name: github-pages |
| 72 | + url: ${{ steps.deployment.outputs.page_url }} |
| 73 | + needs: test |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Download artifact |
| 77 | + uses: actions/download-artifact@v3 |
| 78 | + with: |
| 79 | + name: docs |
| 80 | + |
| 81 | + - name: Unzip artifact |
| 82 | + uses: montudor/action-zip@v1 |
| 83 | + with: |
| 84 | + args: unzip -qq ${{ env.ARTIFACT }} -d dir |
| 85 | + |
| 86 | + - name: Setup Pages |
| 87 | + uses: actions/configure-pages@v2 |
| 88 | + |
| 89 | + - name: Upload artifact |
| 90 | + uses: actions/upload-pages-artifact@v1 |
| 91 | + with: |
| 92 | + path: dir |
| 93 | + |
| 94 | + - name: Deploy to GitHub Pages |
| 95 | + id: deployment |
| 96 | + uses: actions/deploy-pages@v1 |
| 97 | + |
| 98 | + publish-indexes: |
| 99 | + needs: build |
| 100 | + runs-on: ubuntu-latest |
| 101 | + container: |
| 102 | + image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-2 |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v3 |
| 105 | + |
| 106 | + - uses: actions/download-artifact@v3 |
| 107 | + with: |
| 108 | + name: algolia-indexes |
| 109 | + |
| 110 | + - uses: montudor/action-zip@v1 |
| 111 | + with: |
| 112 | + args: unzip -qq ${{ env.ALGOLIA_ARTIFACT }} -d algolia-indexes |
| 113 | + |
| 114 | + - run: | |
| 115 | + env "algolia-key=${{env.ALGOLIA_KEY}}" java -jar /opt/builder/help-publication-agent.jar \ |
| 116 | + update-index \ |
| 117 | + --application-name ${{env.ALGOLIA_APP_NAME}} \ |
| 118 | + --index-name ${{env.ALGOLIA_INDEX_NAME}} \ |
| 119 | + --product ${{env.CONFIG_JSON_PRODUCT}} \ |
| 120 | + --version ${{env.CONFIG_JSON_VERSION}} \ |
| 121 | + --index-directory algolia-indexes/ \ |
| 122 | + 2>&1 | tee algolia-update-index-log.txt |
0 commit comments