Add Fern docs platform: scaffolding, CI/CD, ecosystem diagram, and new pages #18
Workflow file for this run
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
| # Generates a shareable Fern preview URL for every docs PR and posts it as a comment. | |
| # Requires the FERN_TOKEN repository secret. | |
| name: Fern Docs Preview | |
| on: | |
| push: | |
| branches: | |
| - "pull-request/[0-9]+" | |
| pull_request: | |
| paths: | |
| - 'docs/**' | |
| - 'fern/**' | |
| - 'package.json' | |
| jobs: | |
| preview: | |
| name: Generate preview | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate preview | |
| id: preview | |
| run: | | |
| output=$(npm run docs:preview 2>&1) | |
| echo "$output" | |
| url=$(printf '%s\n' "$output" \ | |
| | grep -oP 'https://[A-Za-z0-9./?&=_:%#~+-]*buildwithfern\.com[A-Za-z0-9./?&=_:%#~+-]*' \ | |
| | tail -n 1 \ | |
| | perl -CS -pe 's/\x{200B}//g; s/%E2%80%8B$//i') | |
| echo "url=$url" >> "$GITHUB_OUTPUT" | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| - name: Post preview URL | |
| if: steps.preview.outputs.url != '' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '📖 **Docs preview:** ${{ steps.preview.outputs.url }}' | |
| }) |