-
Notifications
You must be signed in to change notification settings - Fork 18
38 lines (32 loc) · 1.04 KB
/
delete-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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