Raise PR to Operator Hub community and prod repos #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: 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 | |
shell: bash | |
run: | | |
git clone 'https://move2kube:${{ secrets.MOVE2KUBE_PATOKEN }}@github.com/move2kube/community-operators' | |
cd community-operators/ || exit 1 | |
git checkout main | |
git config user.name move2kube | |
git config user.email move2kube@gmail.com | |
echo 'copy-bundle-into-fork-creating-new-version-dir' | |
cd operators/move2kube-operator/ || exit 1 | |
VERSION='${{ github.event.inputs.tag }}' | |
VERSION_WITHOUT_V="${VERSION#v}" | |
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile | |
echo 'make a commit' | |
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}"'"}' | |
- name: checkout-the-move2kube-fork-of-the-prod-upstream-repo | |
shell: bash | |
run: | | |
git clone 'https://move2kube:${{ secrets.MOVE2KUBE_PATOKEN }}@github.com/move2kube/community-operators-prod' | |
cd community-operators-prod/ || exit 1 | |
git checkout main | |
git config user.name move2kube | |
git config user.email move2kube@gmail.com | |
echo 'copy-bundle-into-fork-of-prod-repo-creating-new-version-dir' | |
cd operators/move2kube-operator/ || exit 1 | |
VERSION='${{ github.event.inputs.tag }}' | |
VERSION_WITHOUT_V="${VERSION#v}" | |
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile | |
echo 'make a commit' | |
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}"'"}' |