Skip to content

Delete Web Preview

Delete Web Preview #99

name: Delete Web Preview
on:
delete:
branches:
- preview-**
jobs:
Delete-Preview-Branch:
if: ${{ github.repository_owner == 'path-cc' }}
runs-on: ubuntu-ubuntu-latest
env:
preview_url: https://github.com/path-cc/web-preview.git
steps:
- uses: actions/checkout@v2
- name: Get branch name
run: echo "BRANCH_NAME=${{ github.event.ref }}" >> $GITHUB_ENV
- name: Setup SSH Keys and known_hosts
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.WEB_PREVIEW_DEPLOY_KEY }}
- name: Setup Github User
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Build and Deploy
run: |
git remote add web-preview ${{ env.preview_url }}
git fetch --all
git checkout -b preview web-preview/main
git rm -rf ${{ env.BRANCH_NAME }}
git add .
git commit -m "Remove the Deleted Branch"
git push web-preview HEAD:main