render-olm-catalog #354
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: | |
| - main | |
| paths: | |
| - .github/workflows/render-olm-catalog.yaml | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Select Environment' | |
| required: true | |
| default: 'devel' | |
| type: choice | |
| options: | |
| - devel | |
| schedule: | |
| - cron: "0 1 * * *" # At 1AM everyday | |
| concurrency: | |
| group: dispatch-${{ github.run_id }} | |
| cancel-in-progress: false | |
| jobs: | |
| collect-branches: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Get branches matching pattern | |
| id: set-matrix | |
| run: | | |
| # List all branches and filter | |
| branches=$(gh api repos/${{ github.repository }}/branches --paginate -q '.[] | .name' | grep -E '^(release-v.*\.x$|next$)') | |
| echo "Found branches:" | |
| echo "$branches" | |
| # Convert to JSON array for matrix | |
| json=$(jq -nc --argjson arr "$(printf '%s\n' "$branches" | jq -R . | jq -s .)" '{branch: $arr}') | |
| echo "Matrix JSON: $json" | |
| echo "matrix=$json" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| needs: collect-branches | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: ${{ fromJSON(needs.collect-branches.outputs.matrix) }} | |
| steps: | |
| - name: Trigger render-olm-catalog workflow for ${{ matrix.branch }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Triggering workflow for branch: ${{ matrix.branch }}" | |
| gh workflow run "render-olm-catalog.yaml" \ | |
| --ref "${{ matrix.branch }}" \ | |
| --repo "${{ github.repository }}" |