Publish OperatorHub release #32
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: Publish OperatorHub release | |
on: | |
workflow_run: | |
workflows: | |
- Release | |
types: | |
- completed | |
jobs: | |
update: | |
name: Publish new OperatorHub release | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' && ! contains(github.event.workflow_run.head_branch, '-') }} | |
strategy: | |
matrix: | |
repo: | |
- fork: VictoriaMetrics/operatorhub-operators | |
upstream: k8s-operatorhub/community-operators | |
- fork: VictoriaMetrics/openshift-community-operators-prod | |
upstream: redhat-openshift-ecosystem/community-operators-prod | |
steps: | |
- name: Check out OperatorHub operators repo fork | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.repo.upstream }} | |
ref: main | |
token: ${{ secrets.VM_BOT_GH_TOKEN }} | |
path: __k8s-operatorhub-repo | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
id: import-gpg | |
with: | |
gpg_private_key: ${{ secrets.VM_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.VM_BOT_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
workdir: __k8s-operatorhub-repo | |
- uses: dawidd6/action-download-artifact@v6 | |
with: | |
name: olm | |
workflow: main.yaml | |
github_token: ${{ secrets.VM_BOT_GH_TOKEN }} | |
run_id: ${{ github.event.workflow_run.id }} | |
path: bundle | |
- name: Add operatorhub bundle | |
id: update | |
run: | | |
VERSION=$(ls bundle | head -1) | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
export MANIFEST_PATH=bundle/${VERSION}/manifests/victoriametrics-operator.clusterserviceversion.yaml | |
export REPLACE_VERSION=$(find __k8s-operatorhub-repo/operators/victoriametrics-operator/* -maxdepth 0 -type d -exec basename {} \; | sort -V -r | head -1) | |
yq -i '.spec.replaces = "victoriametrics-operator.v" + strenv(REPLACE_VERSION)' $MANIFEST_PATH | |
mkdir -p __k8s-operatorhub-repo/operators/victoriametrics-operator | |
mv bundle/* __k8s-operatorhub-repo/operators/victoriametrics-operator/ | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
add-paths: operators/victoriametrics-operator | |
commit-message: 'victoriametrics-operator: ${{ steps.update.outputs.VERSION }}' | |
signoff: true | |
committer: "Github Actions <${{ steps.import-gpg.outputs.email }}>" | |
path: __k8s-operatorhub-repo | |
push-to-fork: ${{ matrix.repo.fork }} | |
branch: vm-operator-release-${{ steps.update.outputs.VERSION }} | |
token: ${{ secrets.VM_BOT_GH_TOKEN }} | |
delete-branch: true | |
title: 'victoriametrics-operator: (${{ steps.update.outputs.VERSION }})' | |
body: | | |
Added OLM package for [VictoriaMetrics operator ${{ steps.update.outputs.VERSION }}"](https://github.com/VictoriaMetrics/operator/releases/tag/v${{ steps.update.outputs.VERSION }}) | |
> Auto-generated by `Github Actions Bot` |