1 - Trigger Operator Builds #53
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: 1 - Trigger Operator Builds | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| TARGET_BRANCH: | |
| description: 'RELEASE_BRANCH to checkout (e.g. release-1.17)' | |
| required: true | |
| type: string | |
| permissions: {} | |
| jobs: | |
| prepare-component-builds: | |
| name: Trigger Component Builds for ${{ inputs.TARGET_BRANCH }} | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write # To push branches | |
| pull-requests: write # To create PRs | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: ${{ inputs.TARGET_BRANCH }} | |
| - name: Set up Git config | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Update BUILD file | |
| run: make update-build | |
| - 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 | |
| - name: Create Pull Request | |
| id: create_pr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore(build): bump to ${{ steps.metadata.outputs.build }}" | |
| branch: build/component-${{ steps.metadata.outputs.build }}-${{ steps.metadata.outputs.ts }} | |
| delete-branch: true | |
| title: "chore(build): bump to ${{ steps.metadata.outputs.build }}" | |
| body: | | |
| This PR updates the `BUILD` file with the next operator build version. | |
| **Build:** `${{ steps.metadata.outputs.build }}` | |
| Automatically generated for `${{ inputs.TARGET_BRANCH }}` using GitHub Actions.. | |
| labels: | | |
| auto-merge | |
| base: ${{ inputs.TARGET_BRANCH }} | |
| # TODO: migrate to gh cli | |
| # ref: https://github.com/peter-evans/enable-pull-request-automerge?tab=readme-ov-file#enable-pull-request-auto-merge | |
| - name: Enable auto-merge | |
| if: steps.create_pr.outputs.pull-request-number != '' | |
| uses: peter-evans/enable-pull-request-automerge@v3 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| merge-method: squash | |
| pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} |