Skip to content

Commit bf9008d

Browse files
ci: automate the process of making a PR to Operator Hub repos (#71)
Signed-off-by: Harikrishnan Balagopal <[email protected]>
1 parent 791bf24 commit bf9008d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/raise-pr.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Raise PR to Operator Hub community and prod repos
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "current tag: The tag for this release"
8+
required: true
9+
default: v0.1.0-rc.2
10+
commit_ref:
11+
description: "commit ref: The branch or tag of the commit to use for the release."
12+
required: false
13+
default: main
14+
15+
jobs:
16+
commit_and_raise_pr:
17+
name: Make a commit with the new changes and raise 2 PRs
18+
runs-on: ubuntu-latest
19+
steps:
20+
# copy the bundle from the current repo
21+
- name: checkout-the-current-repo
22+
uses: actions/checkout@v2
23+
with:
24+
ref: ${{ github.event.inputs.commit_ref }}
25+
- name: copy-bundle-into-tmp
26+
run: |
27+
cp -r bundle/ /tmp/bundle-operator-move2kube
28+
cp bundle.Dockerfile /tmp/bundle.Dockerfile
29+
- name: cleanup
30+
run: rm -rf {*,.*} || true
31+
- name: checkout-the-move2kube-fork-of-upstream-repo
32+
run: |
33+
git clone 'https://move2kube:${{ secrets.MOVE2KUBE_PATOKEN }}@github.com/move2kube/community-operators'
34+
git checkout main
35+
git config user.name move2kube
36+
git config user.email [email protected]
37+
- name: copy-bundle-into-fork-creating-new-version-dir
38+
run: |
39+
cd operators/move2kube-operator/ || exit 1
40+
cp -r /tmp/bundle-operator-move2kube '${{ github.event.inputs.tag }}' && cp /tmp/bundle.Dockerfile '${{ github.event.inputs.tag }}/bundle.Dockerfile'
41+
- name: make a commit
42+
# TODO: same as above, expecting commit_ref to be main branch
43+
run: |
44+
git add -A
45+
git commit -s -m "operator move2kube-operator (${{ github.event.inputs.tag }})"
46+
git push -u origin main
47+
# - name: create-pull-request
48+
# run: |
49+
# 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}"'"}'

0 commit comments

Comments
 (0)