Skip to content

Commit

Permalink
ci: create pr to operatorhub
Browse files Browse the repository at this point in the history
  • Loading branch information
FushuWang committed Sep 5, 2023
1 parent 8537215 commit e45a306
Showing 1 changed file with 67 additions and 2 deletions.
69 changes: 67 additions & 2 deletions .github/workflows/release-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
IMAGE_TAG_BASE: docker.cloudsmith.io/streamnative/operators/pulsar-resources-operator
IMAGE_TAG_BASE_QUAY: quay.io/streamnativeio/pulsar-resources-operator
REDHAT_API_KEY: ${{ secrets.REDHAT_API_KEY }}
outputs:
version: ${{ steps.redhat.outputs.version }}
channels: ${{ steps.redhat.outputs.channels }}
default_channel: ${{ steps.redhat.outputs.default_channel }}

steps:
- name: Set up Go 1.19
Expand Down Expand Up @@ -83,7 +87,7 @@ jobs:
_tag_version=${GITHUB_REF##*/}
export VERSION=${_tag_version/v/}
echo $_tag_version, $VERSION
echo "version=$_tag_version" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
export IMG=$IMAGE_TAG_BASE_QUAY:v$VERSION
export IMG_LATEST=$IMAGE_TAG_BASE_QUAY:latest
make docker-build-redhat
Expand All @@ -98,6 +102,67 @@ jobs:
export BUNDLE_IMG=$IMAGE_TAG_BASE_QUAY-bundle:v$VERSION
export CHANNELS=alpha,beta,stable
export DEFAULT_CHANNEL=alpha
echo "channels=$CHANNELS" >> $GITHUB_OUTPUT
echo "default_channel=$DEFAULT_CHANNEL" >> $GITHUB_OUTPUT
make bundle-redhat
make bundle-build
make bundle-push
make bundle-push
operatorhub:
name: Create PR to the operatorhub
needs: build
runs-on: ubuntu-latest
steps:
- name: Sync up the upstream
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
run: |
gh repo sync streamnative/community-operators
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Checkout streamnative community-operators
uses: actions/checkout@v3
with:
repository: streamnative/community-operators
path: community-operators
token: ${{ secrets.SNBOT_GITHUB_TOKEN }}

- name: Setup operator-sdk
run: |
wget https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/operator-sdk_linux_amd64 -O operator-sdk
chmod +x operator-sdk
mv operator-sdk /usr/local/bin/
operator-sdk version
- name: Genarate bundle
env:
VERSION: ${{ needs.build.outputs.version }}
CHANNELS: ${{ needs.build.outputs.channels }}
DEFAULT_CHANNEL: ${{ needs.build.outputs.default_channel }}
IMAGE_TAG_BASE_RELEASE: olm.streamnative.io/streamnativeio/pulsar-resources-operator
run: |
export IMG=$IMAGE_TAG_BASE_RELEASE:v$VERSION
make bundle-redhat
- name: Copy bundle to community-operators and create pr
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
VERSION: ${{ needs.build.outputs.version }}
OPERATOR_NAME: pulsar-resources-operator
run: |
pushd community-operators
git push -d origin $OPERATOR_NAME-$VERSION || echo 'Skip branch deletion'
git checkout -b $OPERATOR_NAME-$VERSION
export TARGET_DIR=operators/$OPERATOR_NAME/$VERSION
mkdir -p $TARGET_DIR
cp -rf ../bundle.Dockerfile $TARGET_DIR
cp -rf ../bundle/* $TARGET_DIR
git add .
git commit -s -m "operator $OPERATOR_NAME ($VERSION)"
git push --set-upstream origin $OPERATOR_NAME-$VERSION
gh pr create --title "operator $OPERATOR_NAME ($VERSION }})" -F ../catalog/.github/openshift/community-operators -R k8s-operatorhub/community-operators
popd

0 comments on commit e45a306

Please sign in to comment.