From 26f3db5e0bae34fe4083781802f255a4344b33a5 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Fri, 26 Jan 2024 18:26:29 +0100 Subject: [PATCH] Midstream/upstream sync CI creation --- .github/workflows/upstream-sync.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/upstream-sync.yml diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml new file mode 100644 index 0000000000..4ee9ea0eba --- /dev/null +++ b/.github/workflows/upstream-sync.yml @@ -0,0 +1,47 @@ +name: Sync main-apache branch with upstream/main + +env: + USERNAME: kie-ci + USEREMAIL: kie-ci0@redhat.com + UPSTREAM_REMOTE: https://github.com/apache/incubator-kie-kogito-examples.git + GITHUB_TOKEN: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }} + +on: + schedule: + - cron: "0 0 * * *" # every day at midnight + workflow_dispatch: + +jobs: + sync-main-apache: + name: Sync main-apache branch + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }} + + - name: Setup git environment + run: | + git config --global user.name "$USERNAME" + git config --global user.email "$USEREMAIL" + git remote add upstream $UPSTREAM_REMOTE + + - name: Fetch all + run: git fetch --all --tags + + - name: Checkout main-apache branch + run: git checkout --track origin/main-apache + + - name: Pull main-apache branch + run: git pull + + - name: Merge upstream/main branch + run: git merge --no-edit upstream/main + + - name: Push changes + run: git push + + - name: Push last tag + run: git push origin $(git tag --sort=creatordate | tail -n 1)