3 - Trigger Catalog Build #9
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: 3 - Trigger Catalog Build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| TARGET_BRANCH: | |
| description: 'RELEASE_BRANCH to checkout (e.g. release-1.17)' | |
| required: true | |
| type: string | |
| BUILD_TYPE: | |
| description: 'Type of build' | |
| required: false | |
| default: release-candidate | |
| type: choice | |
| options: | |
| - nightly | |
| - release-candidate | |
| # For reusable workflows | |
| workflow_call: | |
| inputs: | |
| TARGET_BRANCH: | |
| required: true | |
| type: string | |
| BUILD_TYPE: | |
| description: 'Type of build - nightly or release-candidate' | |
| required: false | |
| default: release-candidate | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate-catalog: | |
| name: Generate Catalog for ${{ inputs.TARGET_BRANCH }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ inputs.TARGET_BRANCH }} | |
| - name: Install skopeo | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y skopeo podman | |
| - name: Generate catalog | |
| shell: bash | |
| run: make catalog | |
| - name: Prepare metadata for PR | |
| id: metadata | |
| run: | | |
| BUILD=$(cat BUILD) | |
| TIMESTAMP=$(date -u +"%Y%m%d-%H%M%S") | |
| echo "build=$BUILD" >> $GITHUB_OUTPUT | |
| echo "ts=$TIMESTAMP" >> $GITHUB_OUTPUT | |
| BUILD_TYPE="${{ inputs.BUILD_TYPE }}" | |
| if [[ "$BUILD_TYPE" == "release-candidate" ]]; then | |
| echo "labels=release-candidate" >> "$GITHUB_OUTPUT" | |
| echo "title=chore(release-candidate): update catalog for build $BUILD" >> "$GITHUB_OUTPUT" | |
| echo "description=This PR updates the catalog using the release-candidate bundle build.<br>**Build:** $BUILD <br>**Timestamp:** $TIMESTAMP <br><br>Automatically generated by GitHub Actions." >> "$GITHUB_OUTPUT" | |
| else | |
| echo "labels=nightly,do-not-merge" >> "$GITHUB_OUTPUT" | |
| echo "title=chore(nightly): update catalog for build $BUILD" >> "$GITHUB_OUTPUT" | |
| echo "description=This PR updates the catalog using the nightly bundle build.<br>**Build:** $BUILD <br>**Timestamp:** $TIMESTAMP <br><br>Please **do not merge** this PR. It is auto-generated to trigger a catalog build from Konflux.<br>Separate PRs will be created for production bundle updates.<br><br>Automatically generated by GitHub Actions." >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create catalog pull request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} # Default GITHUB_TOKEN has insufficient permissions to create PRs in other repos | |
| path: catalog | |
| commit-message: "${{ steps.metadata.outputs.title }}" | |
| branch: build/catalog-${{ steps.metadata.outputs.build }}-${{ steps.metadata.outputs.ts }} | |
| delete-branch: true | |
| title: "${{ steps.metadata.outputs.title }}" | |
| committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
| author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
| body: "${{ steps.metadata.outputs.description }}" | |
| labels: "${{ steps.metadata.outputs.labels }}" |