Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRVLOGIC-281: Move upstream-sync CI to kie-ci repository #1554

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated workflow
fantonangeli committed Apr 17, 2024
commit 3d31bd0cdfa7f11bbee25c236e0091cf266a694e
40 changes: 29 additions & 11 deletions .ci/actions/upstream-sync/action.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,65 @@
name: Sync main-apache branch with upstream/main
name: 'Sync main-apache branch'
description: 'Sync main-apache branch with upstream/main'

inputs:
username:
description: 'Git username'
required: true
description: 'Username for git'
required: false
default: kie-ci
useremail:
description: 'Git user email'
required: true
description: 'User email for git'
required: false
default: kie-ci0@redhat.com
upstream_remote:
description: 'URL of the upstream remote repository'
required: true
github_token:
description: 'GitHub token for authentication'
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:
# TODO: uncomment
# if: github.repository_owner == 'kiegroup'
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ inputs.github_token }}
token: $GITHUB_TOKEN

- 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
run: git push
shell: bash
run: |
set -x
git push${{ inputs.dry_run == 'true' && ' --dry-run' || '' }}

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