Merge pull request #776 from red-hat-data-services/konflux/component-… #4
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: Bundle Sync CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'rhoai-2.1[6-9]+' # Trigger the workflow on pushes to any rhoai-* branch | |
paths: | |
- 'bundle/**' # Trigger the workflow for changes to any file in the bundle directory | |
- 'Dockerfiles/bundle.Dockerfile' # Trigger the workflow for changes to the Dockerfile | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
env: | |
GITHUB_ORG: red-hat-data-services | |
GITHUB_RKA_ORG: rhoai-rhtap | |
jobs: | |
sync: | |
if: ${{ github.ref_name != 'main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate github-app token | |
id: app-token | |
uses: getsentry/action-github-app-token@v2 | |
with: | |
app_id: ${{ secrets.RHOAI_DEVOPS_APP_ID }} | |
private_key: ${{ secrets.RHOAI_DEVOPS_APP_PRIVATE_KEY }} | |
- name: Checkout source repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.GITHUB_ORG }}/rhods-operator | |
path: source_repo | |
ref: ${{ github.ref_name }} # Use the same branch name as in the event | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Checkout target repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.GITHUB_ORG }}/RHOAI-Build-Config | |
path: target_repo | |
ref: ${{ github.ref_name }} # Use the same branch name as in the event | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Sync Bundle Files | |
run: | | |
mkdir -p target_repo/to-be-processed/bundle | |
echo "Updating bundle related files" | |
cp -r source_repo/bundle/* target_repo/to-be-processed/bundle | |
# echo "Updating Dockerfile" | |
# cp source_repo/Dockerfiles/bundle.Dockerfile target_repo/to-be-processed/bundle/Dockerfile | |
- name: Commit and push the changes to release branch | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ steps.app-token.outputs.token }} | |
branch: ${{ github.ref_name }} | |
message: "Sync changes from source repo" | |
repository: ${{ env.GITHUB_ORG }}/RHOAI-Build-Config | |
directory: target_repo | |
author_name: Openshift-AI DevOps | |
author_email: [email protected] |