|
| 1 | +name: Preview |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +jobs: |
| 6 | + deploy: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v1 |
| 11 | + - uses: actions/cache@v2 |
| 12 | + with: |
| 13 | + path: "**/node_modules" |
| 14 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 15 | + - name: Install dependencies |
| 16 | + run: yarn |
| 17 | + - name: Build website |
| 18 | + run: yarn build |
| 19 | + - uses: netlify/actions/cli@master |
| 20 | + id: deploy-neflify |
| 21 | + with: |
| 22 | + args: deploy --dir=build/ |
| 23 | + env: |
| 24 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 25 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 26 | + - name: Find Deploy Comment |
| 27 | + uses: peter-evans/find-comment@v1 |
| 28 | + id: find_comment |
| 29 | + with: |
| 30 | + token: ${{ secrets.BOT_TOKEN }} |
| 31 | + issue-number: ${{ github.event.number }} |
| 32 | + comment-author: pythonpizzabot |
| 33 | + - name: Create comment |
| 34 | + uses: peter-evans/create-or-update-comment@v1 |
| 35 | + if: ${{ steps.find_comment.outputs.comment-id == null }} |
| 36 | + with: |
| 37 | + token: ${{ secrets.BOT_TOKEN }} |
| 38 | + issue-number: ${{ github.event.number }} |
| 39 | + body: | |
| 40 | + This pull request is being automatically deployed to Netlify. |
| 41 | +
|
| 42 | + 🔍 Inspect: ${{ steps.deploy-neflify.outputs.NETLIFY_LOGS_URL }} |
| 43 | + ✅ Preview: ${{ steps.deploy-neflify.outputs.NETLIFY_URL }} |
| 44 | + - name: Update comment |
| 45 | + uses: peter-evans/create-or-update-comment@v1 |
| 46 | + if: ${{ steps.find_comment.outputs.comment-id != null }} |
| 47 | + with: |
| 48 | + token: ${{ secrets.BOT_TOKEN }} |
| 49 | + issue-number: ${{ github.event.number }} |
| 50 | + edit-mode: replace |
| 51 | + comment-id: ${{ steps.find_comment.outputs.comment-id }} |
| 52 | + body: | |
| 53 | + This pull request is being automatically deployed to Netlify. |
| 54 | +
|
| 55 | + 🔍 Inspect: ${{ steps.deploy-neflify.outputs.NETLIFY_LOGS_URL }} |
| 56 | + ✅ Preview: ${{ steps.deploy-neflify.outputs.NETLIFY_URL }} |
0 commit comments