Skip to content

Delete Web Preview

Delete Web Preview #39

name: Delete Web Preview
on:
delete:
branches:
- preview-**
jobs:
Delete-Preview-Branch:
if: ${{ github.repository_owner == 'osg-htc' }}
runs-on: ubuntu-latest
env:
preview_url: https://github.com/osg-htc/web-preview.git
steps:
- uses: actions/checkout@v3
- name: Get branch name
run: echo "BRANCH_NAME=${{ github.event.ref }}" >> $GITHUB_ENV
- name: Setup SSH Keys and known_hosts
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.WEB_PREVIEW_DEPLOY_KEY }}
- name: Setup Github User
run: |
git config user.name "Automatic preview publish"
git config user.email "[email protected]"
- 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