|
| 1 | +name: publish-operators-for-ui-e2e-tests |
| 2 | +on: |
| 3 | + issue_comment: |
| 4 | + types: [created] |
| 5 | + # temporary, just to test the workflow |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened, ready_for_review] |
| 8 | + |
| 9 | +env: |
| 10 | + GOPATH: /tmp/go |
| 11 | + |
| 12 | +jobs: |
| 13 | + binary: |
| 14 | + name: Build & push operator bundles for UI e2e tests |
| 15 | + |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + if: ${{ github.event.comment == '' || contains(github.event.comment.body, '/retest') || contains(github.event.comment.body, '/test all') || contains(github.event.comment.body, '/test e2e') }} |
| 18 | + steps: |
| 19 | + # Checkout from PR event - in that case the comment field is empty |
| 20 | + - name: Checkout code from PR event |
| 21 | + uses: actions/checkout@v4 |
| 22 | + if: ${{ github.event.comment == '' }} |
| 23 | + with: |
| 24 | + ref: ${{github.event.pull_request.head.ref}} |
| 25 | + repository: ${{github.event.pull_request.head.repo.full_name}} |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + # If the workflow was triggered based on comment, then we need to get the information about the PR |
| 29 | + # Is executed only for comment events - in that case the pull_request field is empty |
| 30 | + - name: Send Github API Request to get PR data |
| 31 | + id: request |
| 32 | + uses: octokit/request-action@v2.4.0 |
| 33 | + if: ${{ github.event.pull_request == '' }} |
| 34 | + with: |
| 35 | + route: ${{ github.event.issue.pull_request.url }} |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + |
| 39 | + # Checkout the code based on the data retrieved from the previous step |
| 40 | + # Is executed only for comment events - in that case the pull_request field is empty |
| 41 | + - name: Checkout code from PR |
| 42 | + uses: actions/checkout@v4 |
| 43 | + if: ${{ github.event.pull_request == '' }} |
| 44 | + with: |
| 45 | + repository: ${{ fromJson(steps.request.outputs.data).head.repo.full_name }} |
| 46 | + ref: ${{ fromJson(steps.request.outputs.data).head.ref }} |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Install Go |
| 50 | + uses: actions/setup-go@v5 |
| 51 | + with: |
| 52 | + go-version-file: go.mod |
| 53 | + |
| 54 | + - name: Cache dependencies |
| 55 | + uses: actions/cache@v4 |
| 56 | + with: |
| 57 | + path: ~/go/pkg/mod |
| 58 | + key: ${{ runner.os }}-go-${{ hashFiles ('**/go.sum') }} |
| 59 | + restore-keys: | |
| 60 | + ${{ runner.os }}-go- |
| 61 | +
|
| 62 | + - uses: actions/setup-python@v5 |
| 63 | + with: |
| 64 | + python-version: '3.x' |
| 65 | + |
| 66 | + - name: Prepare tools |
| 67 | + uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master |
| 68 | + |
| 69 | + # Execute composite action using values from PR event |
| 70 | + # Is executed only for PR events - in that case the comment field is empty |
| 71 | + - name: Publish current operator bundles for host & member based on PR event |
| 72 | + uses: rsoaresd/toolchain-cicd/publish-operators-for-ui-e2e-tests@add_actions_to_ui_e2e_tests |
| 73 | + if: ${{ github.event.comment == '' }} |
| 74 | + with: |
| 75 | + quay-token: ${{ secrets.TEST_QUAY_TOKEN }} |
| 76 | + quay-namespace: codeready-toolchain-test |
| 77 | + sha: ${{ github.event.pull_request.head.sha }} |
| 78 | + pr-number: ${{ github.event.pull_request.number }} |
| 79 | + author: ${{ github.event.pull_request.head.user.login }} |
| 80 | + gh-head-ref: ${{ github.event.pull_request.head.ref }} |
| 81 | + |
| 82 | + # Execute composite action using values from PR event |
| 83 | + # Is executed only for comment events - in that case the pull_request field is empty |
| 84 | + - name: Publish current operator bundles for host & member based on comment event |
| 85 | + uses: rsoaresd/toolchain-cicd/publish-operators-for-ui-e2e-tests@add_actions_to_ui_e2e_tests |
| 86 | + if: ${{ github.event.pull_request == '' }} |
| 87 | + with: |
| 88 | + quay-token: ${{ secrets.TEST_QUAY_TOKEN }} |
| 89 | + quay-namespace: codeready-toolchain-test |
| 90 | + sha: ${{ fromJson(steps.request.outputs.data).head.sha }} |
| 91 | + pr-number: ${{ fromJson(steps.request.outputs.data).number }} |
| 92 | + author: ${{ fromJson(steps.request.outputs.data).head.user.login }} |
| 93 | + gh-head-ref: ${{ fromJson(steps.request.outputs.data).head.ref }} |
0 commit comments