|
| 1 | +name: 📚🚀 Build documentation on release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: docs-build-${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-docs: |
| 14 | + name: Build Docs |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Setup pnpm |
| 23 | + uses: pnpm/action-setup@v4 |
| 24 | + |
| 25 | + - name: Setup Node |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version-file: "package.json" |
| 29 | + cache: pnpm |
| 30 | + |
| 31 | + - name: Install deps |
| 32 | + run: pnpm install --prefer-offline --frozen-lockfile |
| 33 | + |
| 34 | + - name: Generate docs |
| 35 | + working-directory: docs |
| 36 | + env: |
| 37 | + APP_ENV: production |
| 38 | + run: pnpm run generate:docs |
| 39 | + |
| 40 | + - name: Pack generated docs (tarball) |
| 41 | + run: | |
| 42 | + tar -czf docs-generated.tgz -C docs generated-docs |
| 43 | + ls -lh docs-generated.tgz |
| 44 | +
|
| 45 | + - name: Upload generated docs (tgz) |
| 46 | + uses: actions/upload-artifact@v4 |
| 47 | + with: |
| 48 | + name: docs-generated-tgz |
| 49 | + path: docs-generated.tgz |
| 50 | + if-no-files-found: error |
| 51 | + |
| 52 | + - name: Upload versions file |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: docs-versions |
| 56 | + path: docs/app/utils/versions.ts |
| 57 | + if-no-files-found: error |
| 58 | + |
| 59 | + deploy-docs-on-release: |
| 60 | + needs: [build-docs] |
| 61 | + name: Deploy Docs |
| 62 | + environment: |
| 63 | + name: docs-release |
| 64 | + url: ${{ steps.deploy.outputs.app_url }} |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + |
| 69 | + - name: Download generated docs (tgz) |
| 70 | + uses: actions/download-artifact@v4 |
| 71 | + with: |
| 72 | + name: docs-generated-tgz |
| 73 | + path: . |
| 74 | + |
| 75 | + - name: Unpack generated docs into docs/ |
| 76 | + run: | |
| 77 | + set -euxo pipefail |
| 78 | + tar -xzf docs-generated.tgz -C docs |
| 79 | + ls -laR docs/generated-docs | sed -n '1,200p' |
| 80 | +
|
| 81 | + - name: Download versions file |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + name: docs-versions |
| 85 | + path: docs/app/utils |
| 86 | + |
| 87 | + - uses: forge-42/fly-deploy@v1.0.0-rc.2 |
| 88 | + id: deploy |
| 89 | + env: |
| 90 | + FLY_ORG: ${{ vars.FLY_ORG }} |
| 91 | + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
| 92 | + FLY_REGION: ${{ vars.FLY_REGION }} |
| 93 | + with: |
| 94 | + workspace_name: docs |
| 95 | + app_name: react-router-devtools-docs-release |
| 96 | + use_isolated_workspace: true |
| 97 | + env_vars: | |
| 98 | + APP_ENV=production |
| 99 | + GITHUB_OWNER=${{ github.repository_owner }} |
| 100 | + GITHUB_REPO=${{ github.event.repository.name }} |
| 101 | + GITHUB_REPO_URL=https://github.com/${{ github.repository }} |
0 commit comments