Sync fork with upstream #335
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: Sync fork with upstream | |
on: | |
workflow_dispatch: # on button click | |
schedule: | |
- cron: '30 1 * * *' # every day at 1:30 minutes | |
env: | |
UPSTREAM_URL: https://github.com/lassekongo83/adw-gtk3.git | |
UPSTREAM_BRANCH: main | |
jobs: | |
sync: | |
if: github.repository == 'ronny-rentner/adwaita-gtk3-gtk4-theme' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Show branch | |
run: echo "Syncing fork from $UPSTREAM_URL/$UPSTREAM_BRANCH to $GITHUB_REF" | |
- name: Sync latest commits from upstream repo | |
id: sync | |
run: | | |
git remote add upstream $UPSTREAM_URL | |
git fetch upstream $UPSTREAM_BRANCH | |
git rebase --autosquash --autostash upstream/$UPSTREAM_BRANCH | |
git push --force origin ${GITHUB_REF#refs/heads/} | |
git config --local --add safe.directory . | |
git push --porcelain --force origin ${GITHUB_REF#refs/heads/} | grep '\[up to date\]' && echo "release=yes" >> $GITHUB_OUTPUT | |
release: | |
needs: sync | |
if: ${{ success() && needs.sync.outputs.release == 'yes' }} | |
uses: ./.github/workflows/release.yml | |
secrets: inherit |