mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Add Preview action (#893)
This commit is contained in:
16
.github/workflows/pr-closed.yml
vendored
Normal file
16
.github/workflows/pr-closed.yml
vendored
Normal file
@@ -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 }}
|
||||
28
.github/workflows/pr-preview.yml
vendored
Normal file
28
.github/workflows/pr-preview.yml
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user