|
26 | 26 | pip install --upgrade "jax[cuda12-local]==0.6.2" |
27 | 27 | pip install numpyro pyro-ppl |
28 | 28 | python scripts/test-jax-install.py |
| 29 | + - name: Setup Node.js |
| 30 | + uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version: '18' |
| 33 | + cache: 'npm' |
| 34 | + - name: Install Netlify CLI |
| 35 | + run: npm install -g netlify-cli |
29 | 36 | - name: Check nvidia Drivers |
30 | 37 | shell: bash -l {0} |
31 | 38 | run: nvidia-smi |
@@ -78,13 +85,73 @@ jobs: |
78 | 85 | with: |
79 | 86 | name: execution-reports |
80 | 87 | path: _build/html/reports |
81 | | - - name: Preview Deploy to Netlify |
82 | | - uses: nwtgck/actions-netlify@v3 |
| 88 | + - name: Deploy to Netlify |
| 89 | + id: netlify-deploy |
| 90 | + run: | |
| 91 | + # Deploy to Netlify and capture the deploy URL |
| 92 | + DEPLOY_URL=$(netlify deploy \ |
| 93 | + --dir=. \ |
| 94 | + --site=${{ secrets.NETLIFY_SITE_ID }} \ |
| 95 | + --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \ |
| 96 | + --json | jq -r '.deploy_url') |
| 97 | + |
| 98 | + echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_OUTPUT |
| 99 | + echo "Preview URL: $DEPLOY_URL" |
| 100 | +
|
| 101 | + - name: Comment PR with preview link |
| 102 | + uses: actions/github-script@v7 |
| 103 | + with: |
| 104 | + script: | |
| 105 | + const deployUrl = '${{ steps.netlify-deploy.outputs.DEPLOY_URL }}'; |
| 106 | + const comment = `🚀 **Preview deployed!** |
| 107 | + |
| 108 | + Preview URL: ${deployUrl} |
| 109 | + |
| 110 | + Built from commit: ${context.sha.substring(0, 7)}`; |
| 111 | + |
| 112 | + // Check if we already commented on this PR |
| 113 | + const { data: comments } = await github.rest.issues.listComments({ |
| 114 | + owner: context.repo.owner, |
| 115 | + repo: context.repo.repo, |
| 116 | + issue_number: context.issue.number, |
| 117 | + }); |
| 118 | + |
| 119 | + const botComment = comments.find(comment => |
| 120 | + comment.user.type === 'Bot' && |
| 121 | + comment.body.includes('Preview deployed!') |
| 122 | + ); |
| 123 | + |
| 124 | + if (botComment) { |
| 125 | + // Update existing comment |
| 126 | + await github.rest.issues.updateComment({ |
| 127 | + owner: context.repo.owner, |
| 128 | + repo: context.repo.repo, |
| 129 | + comment_id: botComment.id, |
| 130 | + body: comment |
| 131 | + }); |
| 132 | + } else { |
| 133 | + // Create new comment |
| 134 | + await github.rest.issues.createComment({ |
| 135 | + owner: context.repo.owner, |
| 136 | + repo: context.repo.repo, |
| 137 | + issue_number: context.issue.number, |
| 138 | + body: comment |
| 139 | + }); |
| 140 | + } |
| 141 | +
|
| 142 | + - name: Update deployment status |
| 143 | + uses: actions/github-script@v7 |
| 144 | + if: always() |
83 | 145 | with: |
84 | | - publish-dir: '_build/html/' |
85 | | - production-branch: main |
86 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
87 | | - deploy-message: "Preview Deploy from GitHub Actions" |
88 | | - env: |
89 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
90 | | - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 146 | + script: | |
| 147 | + const deployUrl = '${{ steps.netlify-deploy.outputs.DEPLOY_URL }}'; |
| 148 | + const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; |
| 149 | + |
| 150 | + await github.rest.repos.createDeploymentStatus({ |
| 151 | + owner: context.repo.owner, |
| 152 | + repo: context.repo.repo, |
| 153 | + deployment_id: context.payload.deployment?.id || 0, |
| 154 | + state: state, |
| 155 | + environment_url: deployUrl, |
| 156 | + description: state === 'success' ? 'Preview deployed successfully' : 'Preview deployment failed' |
| 157 | + }); |
0 commit comments