[bot:release-v1.22.x] Update catalog #1384
This file contains hidden or 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: render-olm-catalog | |
| on: | |
| push: | |
| branches: | |
| - release-v* | |
| - next | |
| paths: | |
| - nightly-bundle.yaml | |
| - bundle.yaml | |
| - olm/** | |
| - .github/workflows/render-olm-catalog.yaml | |
| pull_request: | |
| branches: | |
| - release-v* | |
| - next | |
| paths: | |
| - nightly-bundle.yaml | |
| - bundle.yaml | |
| - olm/** | |
| - .github/workflows/render-olm-catalog.yaml | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Select Environment' | |
| required: true | |
| default: 'devel' | |
| type: choice | |
| options: | |
| - devel | |
| - staging | |
| - production | |
| concurrency: | |
| group: render-${{ github.ref }}-${{ github.run_id }} | |
| cancel-in-progress: false | |
| jobs: | |
| generate-catalog: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| - name: Configure Docker authentication | |
| env: | |
| DOCKER_CONFIG: /home/runner/.docker | |
| DOCKER_JSON: ${{ secrets.DOCKER_REGISTRY_SECRET }} | |
| run: | | |
| echo ${DOCKER_JSON} > $DOCKER_CONFIG/config.json | |
| - name: Generate OLM Bundles | |
| run: | | |
| curl -sSfLo /usr/local/bin/opm "https://github.com/operator-framework/operator-registry/releases/download/v1.47.0/linux-amd64-opm" | |
| chmod +x /usr/local/bin/opm | |
| ./hack/update-olm-bundle.sh ${{github.event.inputs.environment}} | |
| - name: Update OLM catalog | |
| run: | | |
| ./hack/render-catalog.sh | |
| - name: Commit Changes and Generate PR | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| git config user.name openshift-pipelines-bot | |
| git config user.email [email protected] | |
| BASE_BRANCH=${GITHUB_REF#refs/heads/} | |
| SOURCE_BRANCH=actions/update/operator-update-catalog-${BASE_BRANCH} | |
| git checkout -b ${SOURCE_BRANCH} | |
| git add .konflux/olm-catalog/index/ olm/ | |
| if [[ -z $(git status --porcelain --untracked-files=no) ]]; then | |
| echo "No change, exiting" | |
| exit 0 | |
| fi | |
| git commit -F- <<EOF | |
| [bot:${BASE_BRANCH}] Update catalog | |
| EOF | |
| git push -f origin ${SOURCE_BRANCH} | |
| if [ "$(gh pr list --base ${BASE_BRANCH} --head ${SOURCE_BRANCH} --json url --jq 'length')" = "0" ]; then | |
| echo "creating PR..." | |
| gh pr create -B ${BASE_BRANCH} -H ${SOURCE_BRANCH} --label=automated --label=lgtm --label=approved --fill | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |