Sync API Documentation #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync API Documentation | |
| on: | |
| # Remote trigger from Remix release process | |
| repository_dispatch: | |
| types: [release] | |
| # Manual trigger from repo | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag' | |
| required: true | |
| jobs: | |
| docs: | |
| name: Sync API Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout remix-api-docs | |
| uses: actions/checkout@v4 | |
| with: | |
| path: remix-api-docs | |
| ref: main | |
| - name: Checkout remix | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: remix-run/remix | |
| path: remix | |
| ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag || github.event.inputs.tag }} | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: 'pnpm' | |
| cache-dependency-path: remix/pnpm-lock.yaml | |
| - name: Install/Build remix-api-docs | |
| working-directory: remix-api-docs | |
| run: pnpm install --frozen-lockfile | |
| - name: Install/Build remix | |
| id: remix | |
| working-directory: remix | |
| run: | | |
| pnpm install --frozen-lockfile | |
| pnpm build | |
| echo "remix_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Sync Docs | |
| working-directory: remix-api-docs | |
| run: | | |
| rm -f docs/index.html | |
| rm -rf docs/assets | |
| rm -rf docs/api | |
| pnpm run docs --tag ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag || github.event.inputs.tag }} | |
| pnpm run prerender --all | |
| git add docs/ | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "No changes detected" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git commit -m "Updated API documentation - remix SHA ${{ steps.remix.outputs.remix_sha }}" | |
| git push | |
| echo "Pushed docs changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)" |