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

ci: automate the process of making a PR to Operator Hub repos #71

Merged
merged 2 commits into from
Aug 26, 2023
Merged
Changes from all commits
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
49 changes: 49 additions & 0 deletions .github/workflows/raise-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Raise PR to Operator Hub community and prod repos

on:
workflow_dispatch:
inputs:
tag:
description: "current tag: The tag for this release"
required: true
default: v0.1.0-rc.2
commit_ref:
description: "commit ref: The branch or tag of the commit to use for the release."
required: false
default: main

jobs:
commit_and_raise_pr:
name: Make a commit with the new changes and raise 2 PRs
runs-on: ubuntu-latest
steps:
# copy the bundle from the current repo
- name: checkout-the-current-repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit_ref }}
- name: copy-bundle-into-tmp
run: |
cp -r bundle/ /tmp/bundle-operator-move2kube
cp bundle.Dockerfile /tmp/bundle.Dockerfile
- name: cleanup
run: rm -rf {*,.*} || true
- name: checkout-the-move2kube-fork-of-upstream-repo
run: |
git clone 'https://move2kube:${{ secrets.MOVE2KUBE_PATOKEN }}@github.com/move2kube/community-operators'
git checkout main
git config user.name move2kube
git config user.email [email protected]
- name: copy-bundle-into-fork-creating-new-version-dir
run: |
cd operators/move2kube-operator/ || exit 1
cp -r /tmp/bundle-operator-move2kube '${{ github.event.inputs.tag }}' && cp /tmp/bundle.Dockerfile '${{ github.event.inputs.tag }}/bundle.Dockerfile'
- name: make a commit
# TODO: same as above, expecting commit_ref to be main branch
run: |
git add -A
git commit -s -m "operator move2kube-operator (${{ github.event.inputs.tag }})"
git push -u origin main
# - name: create-pull-request
# run: |
# curl "https://api.github.com/repos/k8s-operatorhub/community-operators/pulls" --user "${GITHUB_USER}:${GITHUB_TOKEN}" -X POST --data '{"title": "'"$(git log -1 --format=%s)"'", "base": "main", "body": "An automated PR to update konveyor-operator to v'"${OPERATOR_VERSION}"'", "head": "'"${GITHUB_USER}:${OPERATOR_VERSION}"'"}'