v2.0 #12
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: Deploy Docs | |
| on: | |
| push: | |
| branches: [main, v2.0-rc] | |
| paths: | |
| - "documentation/web-docs/**" | |
| pull_request: | |
| paths: | |
| - "documentation/web-docs/**" | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| jobs: | |
| deploy-preview: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Pull Vercel Environment | |
| run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
| working-directory: documentation/web-docs | |
| - name: Build | |
| run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
| working-directory: documentation/web-docs | |
| env: | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| - name: Deploy Preview | |
| id: deploy | |
| run: | | |
| URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}) | |
| echo "url=$URL" >> $GITHUB_OUTPUT | |
| working-directory: documentation/web-docs | |
| - name: Comment PR | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const url = '${{ steps.deploy.outputs.url }}'; | |
| const body = `## 📖 Docs Preview\n\nDeployed to: ${url}\n\n*This preview was automatically generated for documentation changes.*`; | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes('📖 Docs Preview')); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } | |
| deploy-production: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Pull Vercel Environment | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| working-directory: documentation/web-docs | |
| - name: Build | |
| run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| working-directory: documentation/web-docs | |
| env: | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| - name: Deploy Production | |
| run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| working-directory: documentation/web-docs |