From cb2c6225e928cf03ba9345e1a251614f28109740 Mon Sep 17 00:00:00 2001 From: EliSauder <24995216+EliSauder@users.noreply.github.com> Date: Fri, 27 Dec 2024 19:21:53 -0800 Subject: [PATCH] ci: create pr-preview workflow --- .github/workflows/website-preview.yml | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/website-preview.yml diff --git a/.github/workflows/website-preview.yml b/.github/workflows/website-preview.yml new file mode 100644 index 00000000..323b6d42 --- /dev/null +++ b/.github/workflows/website-preview.yml @@ -0,0 +1,43 @@ +name: Deploy PR Preview Website + +permissions: + contents: read + +on: + pull_request: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Zig + uses: mlugg/setup-zig@v1 + with: + version: 0.13.0 + - name: Build Website + run: zig build + working-directory: website + - name: Publish Website Preview + uses: easingthemes/ssh-deploy@main + with: + SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }} + ARGS: "-vzrli" + SOURCE: website/zig-out + REMOTE_HOST: ${{ secrets.DEPLOY_HOST }} + REMOTE_USER: ${{ secrets.DEPLOY_USER }} + REMOTE_PORT: ${{ secrets.DEPLOY_PORT }} + TARGET: ${{ format('{0}/staging/pulls/{1}', secrets.DEPLOY_ROOT_DATA_PATH, github.event.number) }} + pr-comment: + runs-on: ubuntu-latest + needs: deploy + permissions: + pull-requests: write + steps: + - uses: mshick/add-pr-comment@v2 + with: + message: | + Heya! + You can check out a preview of your PR at [${{vars.WEBSITE_STAGING_HOST}}/pulls/${{ github.event.number}}](${{vars.WEBSITE_STAGING_HOST}}/pulls/${{ github.event.number}})!