1
0
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:
Sergey Panteleev
2023-12-11 18:02:30 +03:00
committed by GitHub
parent 9482f9bd43
commit 5006cc0b8f
2 changed files with 44 additions and 0 deletions

16
.github/workflows/pr-closed.yml vendored Normal file
View 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
View 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