Create sync-staging.yml
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: Sync staging from master
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Syncing staging branch
|
||||
if: github.ref == 'refs/heads/master' && success()
|
||||
run: |
|
||||
echo "Syncing staging branch"
|
||||
git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
|
||||
git remote -v
|
||||
git fetch github
|
||||
git checkout master
|
||||
echo "Pulling master"
|
||||
git pull github master
|
||||
echo "Deleting staging branch"
|
||||
git show-ref --verify --quiet "refs/heads/staging" && git branch -D staging
|
||||
echo "Checking out new staging branch"
|
||||
git checkout -b staging
|
||||
echo "Force pushing new staging"
|
||||
git push -f github staging
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GITHUB_USER: $GITHUB_ACTOR
|
||||
Reference in New Issue
Block a user