[web-php] master: Add Preview action (#893)

From: Date: Mon, 11 Dec 2023 15:16:11 +0000
Subject: [web-php] master: Add Preview action (#893)
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-31274@lists.php.net to get a copy of this message
Author: Sergey Panteleev (saundefined) Committer: GitHub (web-flow) Pusher: saundefined Date: 2023-12-11T18:02:30+03:00 Commit: https://github.com/php/web-php/commit/5006cc0b8fb862b9da4a4082b23bc1c2a9c7e0d3 Raw diff: https://github.com/php/web-php/commit/5006cc0b8fb862b9da4a4082b23bc1c2a9c7e0d3.diff Add Preview action (#893) Changed paths: A .github/workflows/pr-closed.yml A .github/workflows/pr-preview.yml Diff: diff --git a/.github/workflows/pr-closed.yml b/.github/workflows/pr-closed.yml new file mode 100644 index 0000000000..f8a221a6d0 --- /dev/null +++ b/.github/workflows/pr-closed.yml @@ -0,0 +1,16 @@ +name: Remove preview PR +on: + pull_request: + types: [ closed ] + +jobs: + build: + runs-on: "ubuntu-22.04" + if: github.repository_owner == 'php' + steps: + - uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.PREVIEW_REMOTE_HOST }} + username: ${{ secrets.PREVIEW_REMOTE_USER }} + key: ${{ secrets.PREVIEW_SSH_KEY }} + script: bash /home/thephpfoundation/scripts/pr_closed.sh web-php ${{ github.event.number }} diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000000..b553ea50c7 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,28 @@ +name: Preview PR +on: + pull_request_target: + +jobs: + build: + runs-on: "ubuntu-22.04" + if: github.repository_owner == 'php' + steps: + - uses: actions/checkout@v4 + with: + ref: "refs/pull/${{ github.event.number }}/merge" + + - uses: easingthemes/ssh-deploy@main + with: + REMOTE_HOST: ${{ secrets.PREVIEW_REMOTE_HOST }} + REMOTE_USER: ${{ secrets.PREVIEW_REMOTE_USER }} + SSH_PRIVATE_KEY: ${{ secrets.PREVIEW_SSH_KEY }} + TARGET: "/home/thephpfoundation/preview/web-php-pr-${{ github.event.number }}/public" + SCRIPT_BEFORE: bash /home/thephpfoundation/scripts/pr_created_pre.sh web-php ${{ github.event.number }} + SCRIPT_AFTER: bash /home/thephpfoundation/scripts/pr_created.sh web-php ${{ github.event.number }} + + - uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.number }} + edit-mode: 'replace' + body: | + 🚀 Deployed on https://web-php-pr-${{ github.event.number }}.preview.thephp.foundation

« previous php.webmaster (#31274) next »