Delete Web Preview #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |