Skip to content

Commit

Permalink
SRVLOGIC-281: Move upstream-sync CI to kie-ci repository (#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantonangeli authored May 2, 2024
1 parent ac00b15 commit 96a2579
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .ci/actions/upstream-sync/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'Sync main-apache branch'
description: 'Sync main-apache branch with upstream/main'

inputs:
username:
description: 'Username for git'
required: false
default: kie-ci
useremail:
description: 'User email for git'
required: false
default: [email protected]
upstream_remote:
description: 'URL of the upstream remote repository'
required: true
dry_run:
description: 'True to perform a dry run (dry run git push and skip create PR step)'
required: false
default: false

runs:
if: github.repository_owner == 'kiegroup'
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Setup git environment
shell: bash
run: |
set -x
git config --global user.name "${{ inputs.username }}"
git config --global user.email "${{ inputs.useremail }}"
git remote add upstream ${{ inputs.upstream_remote }}
- name: Fetch all
shell: bash
run: git fetch --all --tags

- name: Checkout main-apache branch
shell: bash
run: git checkout --track origin/main-apache

- name: Pull main-apache branch
shell: bash
run: git pull

- name: Merge upstream/main branch
shell: bash
run: git merge --no-edit upstream/main

- name: Push changes
shell: bash
run: |
set -x
git push${{ inputs.dry_run == 'true' && ' --dry-run' || '' }}
- name: Push last tag
shell: bash
run: |
set -x
git push origin $(git tag --sort=creatordate | tail -n 1)${{ inputs.dry_run == 'true' && ' --dry-run' || '' }}

0 comments on commit 96a2579

Please sign in to comment.