|
| 1 | +name: Build and deploy docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_and_deploy_docs: |
| 11 | + environment: |
| 12 | + name: github-pages |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
| 24 | + |
| 25 | + - name: Set up Node.js |
| 26 | + uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: 18 |
| 29 | + cache: npm |
| 30 | + cache-dependency-path: website/package-lock.json |
| 31 | + |
| 32 | + - name: Install Node.js dependencies |
| 33 | + run: | |
| 34 | + npm install |
| 35 | + npm update @apify/docs-theme |
| 36 | + working-directory: ./website |
| 37 | + |
| 38 | + # We do this as early as possible to prevent conflicts if someone else would push something in the meantime |
| 39 | + - name: Commit the updated package.json and lockfile |
| 40 | + run: | |
| 41 | + git config user.name 'GitHub Actions' |
| 42 | + git config user.email 'github-actions[bot]@users.noreply.github.com' |
| 43 | + git add website/package.json |
| 44 | + git add website/package-lock.json |
| 45 | + git diff-index --quiet HEAD || git commit -m 'chore: Automatic docs theme update [skip ci]' || true |
| 46 | + git push |
| 47 | +
|
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v4 |
| 50 | + with: |
| 51 | + python-version: 3.8 |
| 52 | + |
| 53 | + - name: Install Python dependencies |
| 54 | + run: make install-dev |
| 55 | + |
| 56 | + - name: Build generated API reference |
| 57 | + run: make build-api-reference |
| 58 | + |
| 59 | + - name: Build Docusaurus docs |
| 60 | + run: npm run build |
| 61 | + working-directory: ./website |
| 62 | + |
| 63 | + - name: Set up GitHub Pages |
| 64 | + uses: actions/configure-pages@v3 |
| 65 | + |
| 66 | + - name: Upload GitHub Pages artifact |
| 67 | + uses: actions/upload-pages-artifact@v2 |
| 68 | + with: |
| 69 | + path: ./website/build |
| 70 | + |
| 71 | + - name: Deploy artifact to GitHub Pages |
| 72 | + uses: actions/deploy-pages@v2 |
| 73 | + |
| 74 | + - name: Invalidate CloudFront cache |
| 75 | + run: gh workflow run invalidate.yaml --repo apify/apify-docs-private |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
0 commit comments