Merge pull request #86 from vue-pivottable/feat/ci #2
This file contains hidden or 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: Sync Release Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
sync-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate GitHub App Token | |
id: generate-token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
installation_id: ${{ secrets.APP_INSTALLATION_ID }} | |
- name: Sync release branch with main | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
git config --global user.name "GitHub App" | |
git config --global user.email "[email protected]" | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
git fetch origin | |
if git show-ref --quiet refs/remotes/origin/release; then | |
git checkout release | |
git merge --no-edit origin/main | |
else | |
git checkout -b release origin/main | |
fi | |
if git diff --quiet origin/release; then | |
echo "No changes to push." | |
else | |
git push origin release | |
fi |