|
| 1 | +# Handles RC releases cut from release-* branches. |
| 2 | +# Triggered by a chore(release): commit pushed to any release-* branch. |
| 3 | +# Creates a GitHub pre-release, publishes OLM candidate images, and opens a PR |
| 4 | +# against the release branch with the updated catalog index. |
| 5 | +name: Release Branch |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: ['release-*'] |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + e2e-tests-olm: |
| 16 | + if: "startsWith(github.event.head_commit.message, 'chore(release):')" |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v6 |
| 20 | + |
| 21 | + - name: e2e tests through OLM |
| 22 | + uses: ./.github/e2e-tests-olm |
| 23 | + |
| 24 | + create-github-prerelease: |
| 25 | + needs: |
| 26 | + - e2e-tests-olm |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v6 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} |
| 34 | + persist-credentials: false |
| 35 | + |
| 36 | + # standard-version's release-as relies on controller-gen for code generation. |
| 37 | + - name: Setup Go environment |
| 38 | + uses: actions/setup-go@v6 |
| 39 | + with: |
| 40 | + go-version-file: 'go.mod' |
| 41 | + check-latest: true |
| 42 | + |
| 43 | + - name: Generate release notes |
| 44 | + run: | |
| 45 | + git config user.name rhobs-release-bot |
| 46 | + git config user.email release-bot@monitoring.rhobs.io |
| 47 | + npx standard-version -i RELEASE_BODY.md \ |
| 48 | + --release-as $(cat VERSION) \ |
| 49 | + --skip.commit |
| 50 | +
|
| 51 | + - name: Publish tag |
| 52 | + id: publish_tag |
| 53 | + run: | |
| 54 | + git push --follow-tags |
| 55 | + echo "tag_name=$(git describe HEAD --abbrev=0)" >> $GITHUB_OUTPUT |
| 56 | +
|
| 57 | + - name: Create Github release |
| 58 | + uses: ncipollo/release-action@v1 |
| 59 | + with: |
| 60 | + tag: ${{ steps.publish_tag.outputs.tag_name }} |
| 61 | + bodyFile: RELEASE_BODY.md |
| 62 | + # NOTE: We always generate pre-releases and mark them as releases manually |
| 63 | + prerelease: true |
| 64 | + |
| 65 | + publish-olm-candidate: |
| 66 | + needs: |
| 67 | + - create-github-prerelease |
| 68 | + runs-on: ubuntu-latest |
| 69 | + environment: quay |
| 70 | + steps: |
| 71 | + - name: Checkout |
| 72 | + uses: actions/checkout@v6 |
| 73 | + with: |
| 74 | + fetch-depth: 0 |
| 75 | + token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} |
| 76 | + |
| 77 | + - name: Setup Go environment |
| 78 | + uses: actions/setup-go@v6 |
| 79 | + with: |
| 80 | + go-version-file: 'go.mod' |
| 81 | + check-latest: true |
| 82 | + |
| 83 | + - name: Set version |
| 84 | + id: version |
| 85 | + run: | |
| 86 | + version="$(cat VERSION)-rc" |
| 87 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 88 | +
|
| 89 | + - name: Publish catalog |
| 90 | + uses: ./.github/olm-publish |
| 91 | + env: |
| 92 | + IMG_BASE: ${{ vars.IMG_BASE }} |
| 93 | + VERSION: ${{ steps.version.outputs.version }} |
| 94 | + CHANNELS: candidate,development |
| 95 | + DEFAULT_CHANNEL: candidate |
| 96 | + RELEASE_SHA: ${GITHUB_SHA} |
| 97 | + with: |
| 98 | + quay_login: ${{ secrets.QUAY_LOGIN }} |
| 99 | + quay_token: ${{ secrets.QUAY_TOKEN }} |
| 100 | + |
| 101 | + - name: Open catalog PR |
| 102 | + env: |
| 103 | + GH_TOKEN: ${{ secrets.REPOSITORY_PUSH_TOKEN }} |
| 104 | + run: | |
| 105 | + git config user.name rhobs-release-bot |
| 106 | + git config user.email release-bot@monitoring.rhobs.io |
| 107 | +
|
| 108 | + TARGET_BRANCH="${{ github.ref_name }}" |
| 109 | + PR_BRANCH="ci/olm-catalog-candidate-${TARGET_BRANCH}" |
| 110 | + git checkout -b "$PR_BRANCH" |
| 111 | + git add bundle/ olm/index-template.yaml |
| 112 | + git commit -m "ci(bot): update OLM candidate catalog to ${{ steps.version.outputs.version }}" |
| 113 | + git push --force origin "$PR_BRANCH" |
| 114 | +
|
| 115 | + existing=$(gh pr list --head "$PR_BRANCH" --base "$TARGET_BRANCH" --json number --jq '.[0].number') |
| 116 | + if [ -z "$existing" ]; then |
| 117 | + gh pr create \ |
| 118 | + --base "$TARGET_BRANCH" \ |
| 119 | + --head "$PR_BRANCH" \ |
| 120 | + --title "ci: update OLM candidate catalog (${{ steps.version.outputs.version }})" \ |
| 121 | + --body "Automated catalog update for the candidate channel." |
| 122 | + fi |
| 123 | +
|
| 124 | + - name: Publish Package |
| 125 | + uses: ./.github/package-operator-publish |
| 126 | + env: |
| 127 | + IMG_BASE: ${{ vars.IMG_BASE }} |
| 128 | + VERSION: ${{ steps.version.outputs.version }} |
| 129 | + with: |
| 130 | + quay_login: ${{ secrets.QUAY_LOGIN }} |
| 131 | + quay_token: ${{ secrets.QUAY_TOKEN }} |
| 132 | + |
| 133 | + - name: Publish test harness |
| 134 | + uses: ./.github/osd-test-harness-publish |
| 135 | + env: |
| 136 | + IMG_BASE: ${{ vars.IMG_BASE }} |
| 137 | + VERSION: ${{ steps.version.outputs.version }} |
| 138 | + with: |
| 139 | + quay_login: ${{ secrets.QUAY_LOGIN }} |
| 140 | + quay_token: ${{ secrets.QUAY_TOKEN }} |
0 commit comments