Skip to content

Release Community OLM #3

Release Community OLM

Release Community OLM #3

# Copyright 2022 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release Community OLM
on:
workflow_dispatch:
inputs:
channel-tag:
description: 'Operator tag(without prefix v)'
required: true
channels:
description: 'OLM channels'
required: true
default: alpha,beta,stable
default_channel:
description: 'OLM Default channel'
required: true
default: alpha
jobs:
operatorhub:
name: Create PR to the operatorhub
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
GOPRIVATE: github.com/streamnative
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
steps:
- name: Sync up the upstream
run: |
gh repo sync streamnative/community-operators
- name: Setup Git token
run: |
git config --global url."https://${ACCESS_TOKEN}:@github.com/".insteadOf "https://github.com/"
- 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: ${{ inputs.channel-tag }}
CHANNELS: ${{ inputs.channels }}
DEFAULT_CHANNEL: ${{ inputs.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: ${{ inputs.channel-tag }}
OPERATOR_NAME: pulsar-resources-operator
run: |
pushd community-operators
git config --global user.email "[email protected]"
git config --global user.name "streamnativebot"
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 ../.github/operatorhub/community-operators -R k8s-operatorhub/community-operators
popd