diff --git a/.github/workflows/publish-olm-bundle.yaml b/.github/workflows/publish-olm-bundle.yaml new file mode 100644 index 000000000..75835c2c2 --- /dev/null +++ b/.github/workflows/publish-olm-bundle.yaml @@ -0,0 +1,80 @@ +name: Submit release OLM bundle + +on: + release: + types: + - published +# Remove this trigger event once workflow behavior is validated + issues: + types: + - opened + +jobs: + createPullRequest: + name: Publish new OperatorHub release + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Determine Repository Variable + # Remove this conditional logic once the workflow behavior + # is validated + run: | + if [[ "${{ github.event_name }}" == "issues" && "${{ github.event.action }}" == "opened" ]]; then + echo "repository=fmuyassarov/community-operators" >> $GITHUB_ENV + else + echo "repository=k8s-operatorhub/community-operators" >> $GITHUB_ENV + fi + + - name: Build the bundle + run: pushd deployment/operator && VERSION=0.8.1 make bundle && popd + + - name: Checkout upstream community-operators repo + uses: actions/checkout@v4 + with: + repository: ${{ env.repository }} + path: community-operators + ref: main + token: ${{ secrets.BOT_PAT }} + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + id: import-gpg + with: + gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} + git_user_signingkey: true + git_commit_gpgsign: true + workdir: community-operators + + - name: Copy the bundle to the community-operators repo + run: | + mkdir -p community-operators/operators/nri-plugins-operator/v0.8.1 + cp -r deployment/operator/bundle/ community-operators/operators/nri-plugins-operator/v0.8.1 +# mkdir -p community-operators/operators/nri-plugins-operator/${{ github.ref_name }} +# cp -r deployment/operator/bundle/ community-operators/operators/nri-plugins-operator/${{ github.ref_name }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + signoff: true + author: "NRI Plugins Bot <${{ steps.import-gpg.outputs.email }}>" + committer: "Github Actions <${{ steps.import-gpg.outputs.email }}>" + add-paths: | + operators/nri-plugins-operator/** + path: community-operators + push-to-fork: nri-plugins-bot/community-operators + branch: olm-v0.8.1 + # branch: olm-${{ github.ref_name }} + token: ${{ secrets.BOT_PAT }} + delete-branch: false + title: 'nri-plugins-operator v0.8.1' + # title: 'nri-plugins-operator ${{ github.ref_name }}' + commit-message: 'Submit operator nri-plugins-operator v0.8.1' + # commit-message: 'Submit operator nri-plugins-operator ${{ github.ref_name }}' + body: | + Added OLM bundle for [nri-plugins operator ${{ github.ref_name }}](https://github.com/containers/nri-plugins/releases/tag/${{ github.ref_name }}) + > Auto-generated by `Github Actions Bot`