CI: Auto-remove closed PRs from staging #40
1 changed files with 10 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
- closed
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
cleanup-staging:
|
||||
|
@ -11,9 +11,13 @@ jobs:
|
|||
steps:
|
||||
- name: Pipeline info PR
|
||||
run: |
|
||||
echo "PR#${{ github.event.pull_request.number }} ${{ github.event.action }}"
|
||||
echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}"
|
||||
|
||||
- name: Deploy - Remove PR from staging
|
||||
if: github.event.action == 'closed'
|
||||
- name: Staging Deployment - Prepare keys
|
||||
run: |
|
||||
ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts' ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de -t "rm -r /var/www/next.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/"
|
||||
echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploykey.priv
|
||||
chmod 400 deploykey.priv
|
||||
echo "${{ secrets.SSH_KNOWN_HOSTS_FILE }}" > ./known_hosts
|
||||
- name: Staging Deployment - Remove PR from staging
|
||||
run: |
|
||||
ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts' ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de -t "rm -r /var/www/staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/"
|
||||
|
|
Loading…
Reference in a new issue