|
| 1 | +name: 'PR Preview' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-site: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Find Comment |
| 11 | + uses: peter-evans/find-comment@v1 |
| 12 | + id: fc |
| 13 | + with: |
| 14 | + issue-number: ${{ github.event.pull_request.number }} |
| 15 | + comment-author: 'github-actions[bot]' |
| 16 | + body-includes: '.surge.sh) has been generated!' |
| 17 | + - name: Create comment |
| 18 | + if: steps.fc.outputs.comment-id == '' |
| 19 | + uses: peter-evans/create-or-update-comment@v1 |
| 20 | + id: couc |
| 21 | + with: |
| 22 | + issue-number: ${{ github.event.pull_request.number }} |
| 23 | + body: | |
| 24 | + After the build is complete, you can preview the website here. :coffee: :coffee: :coffee: |
| 25 | + - name: Update comment |
| 26 | + if: steps.fc.outputs.comment-id != '' |
| 27 | + uses: peter-evans/create-or-update-comment@v1 |
| 28 | + with: |
| 29 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 30 | + body: | |
| 31 | + After the build is complete, you can preview the website here. :coffee: :coffee: :coffee: |
| 32 | + edit-mode: replace |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + - uses: actions/setup-node@v1 |
| 35 | + with: |
| 36 | + node-version: 14 |
| 37 | + registry-url: 'https://registry.npmjs.org' |
| 38 | + - run: yarn install --frozen-lockfile |
| 39 | + - run: yarn nx build site --configuration=production |
| 40 | + - run: cp ./dist/packages/site/index.html ./dist/packages/site/200.html |
| 41 | + - uses: dswistowski/surge-sh-action@v1 |
| 42 | + with: |
| 43 | + domain: 'react-devui-${{ github.sha }}.surge.sh' |
| 44 | + project: './dist/packages/site' |
| 45 | + login: ${{ secrets.SURGE_LOGIN }} |
| 46 | + token: ${{ secrets.SURGE_TOKEN }} |
| 47 | + - name: Update comment |
| 48 | + if: steps.fc.outputs.comment-id == '' |
| 49 | + uses: peter-evans/create-or-update-comment@v1 |
| 50 | + with: |
| 51 | + comment-id: ${{ steps.couc.outputs.comment-id }} |
| 52 | + body: | |
| 53 | + Website [preview](//react-devui-${{ github.sha }}.surge.sh) has been generated! :tada: :tada: :tada: |
| 54 | + edit-mode: replace |
| 55 | + - name: Update comment |
| 56 | + if: steps.fc.outputs.comment-id != '' |
| 57 | + uses: peter-evans/create-or-update-comment@v1 |
| 58 | + with: |
| 59 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 60 | + body: | |
| 61 | + Website [preview](//react-devui-${{ github.sha }}.surge.sh) has been generated! :tada: :tada: :tada: |
| 62 | + edit-mode: replace |
0 commit comments