Skip to content

Commit

Permalink
WIP - split publish
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
Zerpet committed Aug 28, 2024
1 parent c71a514 commit d487cf7
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions .github/workflows/testing_and_publishing_OLM_bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,73 +185,80 @@ jobs:
kubectl config use-context admin
./OLM-Package-Repo/testfiles/uninstall-rabbitmq-cluster-operator.sh $OLM_INDEX_TAG
publish-bundle:
publish-bundle-operatorhub:
name: Publish on OperatorHub and Openshift marketplace
runs-on: ubuntu-latest
needs: test-olm-package
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout community-operators fork (OperatorHub)
uses: actions/checkout@v4
with:
repository: rabbitmq/community-operators
path: ./community-operators
token: ${{ secrets.RABBITMQ_CI_TOKEN }}

- name: Checkout community-operators-prod fork (Openshift Ecosystem)
uses: actions/checkout@v4
with:
repository: rabbitmq/community-operators-prod
path: ./community-operators-prod
token: ${{ secrets.RABBITMQ_CI_TOKEN }}

- name: Download OLM artifact
uses: actions/download-artifact@v4
with:
name: olm-artifact
path: olm-package-ci

- name: Create branch for OperatorHub PR
env:
BUNDLE_VERSION: ${{ needs.test-olm-package.outputs.olm_package_version }}
# RABBITMQ_CI_EMAIL: secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
# RABBITMQ_CI_TOKEN: secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
run: |
mkdir -p community-operators/operators/rabbitmq-cluster-operator
pushd community-operators/operators/rabbitmq-cluster-operator || exit 1
mkdir -pv operators/rabbitmq-cluster-operator
git config --local user.name "rabbitmq-ci"
git config --local user.email ${{ secrets.RABBITMQ_CI_EMAIL }}
git branch rabbitmq-cluster-operator-$BUNDLE_VERSION
git checkout rabbitmq-cluster-operator-$BUNDLE_VERSION
REPLACE_VERSION=$(ls -1v | tail -2 | head -1)
cp -fR ./../../../$BUNDLE_VERSION .
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
cp -v -fR olm-package-ci/"$BUNDLE_VERSION" ./operators/rabbitmq-cluster-operator/
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./operators/rabbitmq-cluster-operator/$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./operators/rabbitmq-cluster-operator/$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
git add .
git commit -s -m "RabbitMQ operator new release"
git commit -s -m "RabbitMQ Operator release $BUNDLE_VERSION"
git push --set-upstream origin rabbitmq-cluster-operator-$BUNDLE_VERSION
popd

publish-bundle-redhat-marketplace:
name: Publish on OperatorHub and Openshift marketplace
runs-on: ubuntu-latest
needs: test-olm-package
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout community-operators-prod fork (Openshift Ecosystem)
uses: actions/checkout@v4
with:
repository: rabbitmq/community-operators-prod
token: ${{ secrets.RABBITMQ_CI_TOKEN }}

- name: Download OLM artifact
uses: actions/download-artifact@v4
with:
name: olm-artifact
path: olm-package-ci

- name: Create branch for Openshift Ecosystem PR
env:
BUNDLE_VERSION: ${{ needs.test-olm-package.outputs.olm_package_version }}
# RABBITMQ_CI_EMAIL: secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
# RABBITMQ_CI_TOKEN: secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
run: |
cd community-operators-prod/operators/rabbitmq-cluster-operator
mkdir -pv operators/rabbitmq-cluster-operator
git config --local user.name "rabbitmq-ci"
git config --local user.email ${{ secrets.RABBITMQ_CI_EMAIL }}
git branch rabbitmq-cluster-operator-$BUNDLE_VERSION
git checkout rabbitmq-cluster-operator-$BUNDLE_VERSION
REPLACE_VERSION=$(ls -1v | tail -2 | head -1)
cp -fR ./../../../$BUNDLE_VERSION-openshift .
mv $BUNDLE_VERSION-openshift $BUNDLE_VERSION
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
cp -v -fR olm-package-ci/"$BUNDLE_VERSION-openshift" ./operators/rabbitmq-cluster-operator/"$BUNDLE_VERSION"
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./operators/rabbitmq-cluster-operator/"$BUNDLE_VERSION"/manifests/rabbitmq.clusterserviceversion.yaml
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./operators/rabbitmq-cluster-operator/"$BUNDLE_VERSION"/manifests/rabbitmq.clusterserviceversion.yaml
git add .
git commit -s -m "RabbitMQ operator new release"
git commit -s -m "RabbitMQ Operator release $BUNDLE_VERSION"
git push --set-upstream origin rabbitmq-cluster-operator-$BUNDLE_VERSION

0 comments on commit d487cf7

Please sign in to comment.