|
| 1 | +name: Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + id-token: write |
| 11 | + pages: write |
| 12 | + |
| 13 | +env: |
| 14 | + COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} |
| 15 | + ARTIFACT_DOCS: webHelpDO2-all.zip |
| 16 | + INSTANCE: docs/do |
| 17 | + DOMAIN_NAME: deploy-operations.dragon-code.pro |
| 18 | + BUILDER_VERSION: 2025.03.8312 |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + name: Build application |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: Build documentation |
| 31 | + uses: JetBrains/writerside-github-action@v4 |
| 32 | + with: |
| 33 | + instance: ${{ env.INSTANCE }} |
| 34 | + artifact: ${{ env.ARTIFACT_DOCS }} |
| 35 | + docker-version: ${{ env.BUILDER_VERSION }} |
| 36 | + |
| 37 | + - name: Upload artifacts |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: docs |
| 41 | + path: | |
| 42 | + artifacts/${{ env.ARTIFACT_DOCS }} |
| 43 | + artifacts/report.json |
| 44 | + retention-days: 7 |
| 45 | + |
| 46 | + test: |
| 47 | + needs: build |
| 48 | + name: Testing |
| 49 | + runs-on: ubuntu-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Download docs artifact |
| 53 | + uses: actions/download-artifact@v4 |
| 54 | + with: |
| 55 | + name: docs |
| 56 | + path: artifacts |
| 57 | + |
| 58 | + - name: Test documentation |
| 59 | + uses: JetBrains/writerside-checker-action@v1 |
| 60 | + with: |
| 61 | + instance: ${{ env.INSTANCE }} |
| 62 | + |
| 63 | + robots: |
| 64 | + needs: build |
| 65 | + name: Generate robots.txt |
| 66 | + runs-on: ubuntu-latest |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Create robots.txt |
| 70 | + run: | |
| 71 | + touch robots.txt |
| 72 | + echo "User-Agent: *" >> robots.txt |
| 73 | + echo "Disallow: " >> robots.txt |
| 74 | + echo "Host: https://${{ env.DOMAIN_NAME }}" >> robots.txt |
| 75 | + echo "Sitemap: https://${{ env.DOMAIN_NAME }}/sitemap.xml" >> robots.txt |
| 76 | +
|
| 77 | + - name: Upload artifacts |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: robots |
| 81 | + path: robots.txt |
| 82 | + retention-days: 7 |
| 83 | + |
| 84 | + deploy-pages: |
| 85 | + environment: |
| 86 | + name: deploy |
| 87 | + url: ${{ steps.deployment.outputs.page_url }} |
| 88 | + |
| 89 | + needs: |
| 90 | + - test |
| 91 | + - robots |
| 92 | + |
| 93 | + name: Deploy to pages |
| 94 | + runs-on: ubuntu-latest |
| 95 | + |
| 96 | + steps: |
| 97 | + - name: Download docs artifact |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: docs |
| 101 | + |
| 102 | + - name: Download robots artifact |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + name: robots |
| 106 | + |
| 107 | + - name: Unzip artifact |
| 108 | + run: unzip -O UTF-8 -qq '${{ env.ARTIFACT_DOCS }}' -d dir |
| 109 | + |
| 110 | + - name: Move robots |
| 111 | + run: | |
| 112 | + sudo mv robots.txt dir/robots.txt |
| 113 | +
|
| 114 | + - name: Setup Pages |
| 115 | + uses: actions/configure-pages@v5 |
| 116 | + |
| 117 | + - name: Upload artifact |
| 118 | + uses: actions/upload-pages-artifact@v3 |
| 119 | + with: |
| 120 | + path: dir |
| 121 | + |
| 122 | + - name: Deploy to GitHub Pages |
| 123 | + id: deployment |
| 124 | + uses: actions/deploy-pages@v4 |
0 commit comments