publish-components-for-e2e-tests #282
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: publish-components-for-e2e-tests | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: read | |
| env: | |
| GOPATH: /tmp/go | |
| jobs: | |
| binary: | |
| name: Build & push operator bundles & dashboard image for e2e tests | |
| runs-on: ubuntu-24.04 | |
| if: >- | |
| ${{ github.event_name == 'pull_request_target' || | |
| (github.event_name == 'issue_comment' && | |
| (contains(github.event.comment.body, '/retest') || | |
| contains(github.event.comment.body, '/test all') || | |
| contains(github.event.comment.body, '/test e2e'))) }} | |
| steps: | |
| # Checkout from PR event | |
| - name: Checkout code from PR event | |
| uses: actions/checkout@v6 | |
| if: ${{ github.event_name == 'pull_request_target' }} | |
| with: | |
| ref: ${{github.event.pull_request.head.ref}} | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| fetch-depth: 0 | |
| # If the workflow was triggered based on comment, then we need to get the information about the PR | |
| - name: Send Github API Request to get PR data | |
| id: request | |
| uses: octokit/request-action@v2.4.0 | |
| if: ${{ github.event_name == 'issue_comment' }} | |
| with: | |
| route: ${{ github.event.issue.pull_request.url }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Checkout the code based on the data retrieved from the previous step | |
| # Is executed only for comment events | |
| - name: Checkout code from PR | |
| uses: actions/checkout@v6 | |
| if: ${{ github.event_name == 'issue_comment' }} | |
| with: | |
| repository: ${{ fromJson(steps.request.outputs.data).head.repo.full_name }} | |
| ref: ${{ fromJson(steps.request.outputs.data).head.ref }} | |
| fetch-depth: 0 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Prepare tools | |
| uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master | |
| # Execute composite action using values from PR event | |
| # Developer Sandbox Dashboard will be published too in this action | |
| - name: Publish current operator bundles & dashboard image based on PR event | |
| uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master | |
| if: ${{ github.event_name == 'pull_request_target' }} | |
| with: | |
| quay-token: ${{ secrets.TEST_QUAY_TOKEN }} | |
| quay-namespace: codeready-toolchain-test | |
| sha: ${{ github.event.pull_request.head.sha }} | |
| pr-number: ${{ github.event.pull_request.number }} | |
| author: ${{ github.event.pull_request.head.user.login }} | |
| gh-head-ref: ${{ github.event.pull_request.head.ref }} | |
| # Execute composite action using values from PR event | |
| # Developer Sandbox Dashboard will be published too in this action | |
| - name: Publish current operator bundles & dashboard image based on comment event | |
| uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master | |
| if: ${{ github.event_name == 'issue_comment' }} | |
| with: | |
| quay-token: ${{ secrets.TEST_QUAY_TOKEN }} | |
| quay-namespace: codeready-toolchain-test | |
| sha: ${{ fromJson(steps.request.outputs.data).head.sha }} | |
| pr-number: ${{ fromJson(steps.request.outputs.data).number }} | |
| author: ${{ fromJson(steps.request.outputs.data).head.user.login }} | |
| gh-head-ref: ${{ fromJson(steps.request.outputs.data).head.ref }} |