|
| 1 | +name: Release |
| 2 | + |
| 3 | +description: Makes patch releases and creates new release branch |
| 4 | + |
| 5 | +inputs: |
| 6 | + ref: |
| 7 | + description: 'Git reference (branch or commit sha) from which to create the release' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + type: |
| 11 | + description: 'The type of release: "new" for a new release or "patch" for a patch release' |
| 12 | + required: true |
| 13 | + type: choice |
| 14 | + options: |
| 15 | + - patch |
| 16 | + - new |
| 17 | + dry-run: |
| 18 | + description: 'Dry run' |
| 19 | + required: false |
| 20 | + default: true |
| 21 | + type: boolean |
| 22 | + token: |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + |
| 26 | +runs: |
| 27 | + using: "composite" |
| 28 | + steps: |
| 29 | + - name: Prepare Release Info |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + python3 ./tests/ci/create_release.py --prepare-release-info \ |
| 33 | + --ref ${{ inputs.ref }} --release-type ${{ inputs.type }} \ |
| 34 | + ${{ inputs.dry-run && '--dry-run' || '' }} |
| 35 | + echo "::group::Release Info" |
| 36 | + python3 -m json.tool /tmp/release_info.json |
| 37 | + echo "::endgroup::" |
| 38 | + release_tag=$(jq -r '.release_tag' /tmp/release_info.json) |
| 39 | + commit_sha=$(jq -r '.commit_sha' /tmp/release_info.json) |
| 40 | + echo "Release Tag: $release_tag" |
| 41 | + echo "RELEASE_TAG=$release_tag" >> "$GITHUB_ENV" |
| 42 | + echo "COMMIT_SHA=$commit_sha" >> "$GITHUB_ENV" |
| 43 | + - name: Download All Release Artifacts |
| 44 | + if: ${{ inputs.type == 'patch' }} |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + python3 ./tests/ci/create_release.py --download-packages ${{ inputs.dry-run && '--dry-run' || '' }} |
| 48 | + - name: Push Git Tag for the Release |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + python3 ./tests/ci/create_release.py --push-release-tag ${{ inputs.dry-run && '--dry-run' || '' }} |
| 52 | + - name: Push New Release Branch |
| 53 | + if: ${{ inputs.type == 'new' }} |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + python3 ./tests/ci/create_release.py --push-new-release-branch ${{ inputs.dry-run && '--dry-run' || '' }} |
| 57 | + - name: Bump CH Version and Update Contributors' List |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + python3 ./tests/ci/create_release.py --create-bump-version-pr ${{ inputs.dry-run && '--dry-run' || '' }} |
| 61 | + - name: Bump Docker versions, Changelog, Security |
| 62 | + if: ${{ inputs.type == 'patch' }} |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + python3 ./tests/ci/create_release.py --set-progress-started --progress "update ChangeLog" |
| 66 | + [ "$(git branch --show-current)" != "master" ] && echo "not on the master" && exit 1 |
| 67 | + echo "List versions" |
| 68 | + ./utils/list-versions/list-versions.sh > ./utils/list-versions/version_date.tsv |
| 69 | + echo "Update docker version" |
| 70 | + ./utils/list-versions/update-docker-version.sh |
| 71 | + echo "Generate ChangeLog" |
| 72 | + export CI=1 |
| 73 | + docker run -u "${UID}:${GID}" -e PYTHONUNBUFFERED=1 -e CI=1 --network=host \ |
| 74 | + --volume=".:/ClickHouse" clickhouse/style-test \ |
| 75 | + /ClickHouse/tests/ci/changelog.py -v --debug-helpers \ |
| 76 | + --gh-user-or-token=${{ inputs.token }} --jobs=5 \ |
| 77 | + --output="/ClickHouse/docs/changelogs/${{ env.RELEASE_TAG }}.md" ${{ env.RELEASE_TAG }} |
| 78 | + git add ./docs/changelogs/${{ env.RELEASE_TAG }}.md |
| 79 | + echo "Generate Security" |
| 80 | + python3 ./utils/security-generator/generate_security.py > SECURITY.md |
| 81 | + git diff HEAD |
| 82 | + - name: Create ChangeLog PR |
| 83 | + if: ${{ inputs.type == 'patch' && ! inputs.dry-run }} |
| 84 | + uses: peter-evans/create-pull-request@v6 |
| 85 | + with: |
| 86 | + author: "robot-clickhouse <robot-clickhouse@users.noreply.github.com>" |
| 87 | + token: ${{ inputs.token }} |
| 88 | + committer: "robot-clickhouse <robot-clickhouse@users.noreply.github.com>" |
| 89 | + commit-message: Update version_date.tsv and changelogs after ${{ env.RELEASE_TAG }} |
| 90 | + branch: auto/${{ env.RELEASE_TAG }} |
| 91 | + assignees: ${{ github.event.sender.login }} # assign the PR to the tag pusher |
| 92 | + delete-branch: true |
| 93 | + title: Update version_date.tsv and changelog after ${{ env.RELEASE_TAG }} |
| 94 | + labels: do not test |
| 95 | + body: | |
| 96 | + Update version_date.tsv and changelogs after ${{ env.RELEASE_TAG }} |
| 97 | + ### Changelog category (leave one): |
| 98 | + - Not for changelog (changelog entry is not required) |
| 99 | + - name: Reset changes if Dry-run |
| 100 | + if: ${{ inputs.dry-run }} |
| 101 | + shell: bash |
| 102 | + run: | |
| 103 | + git reset --hard HEAD |
| 104 | + - name: Checkout back to GITHUB_REF |
| 105 | + shell: bash |
| 106 | + run: | |
| 107 | + git checkout "$GITHUB_REF_NAME" |
| 108 | + # set current progress to OK |
| 109 | + python3 ./tests/ci/create_release.py --set-progress-completed |
| 110 | + - name: Create GH Release |
| 111 | + shell: bash |
| 112 | + if: ${{ inputs.type == 'patch' }} |
| 113 | + run: | |
| 114 | + python3 ./tests/ci/create_release.py --create-gh-release ${{ inputs.dry-run && '--dry-run' || '' }} |
| 115 | + - name: Export TGZ Packages |
| 116 | + if: ${{ inputs.type == 'patch' }} |
| 117 | + shell: bash |
| 118 | + run: | |
| 119 | + python3 ./tests/ci/artifactory.py --export-tgz ${{ inputs.dry-run && '--dry-run' || '' }} |
| 120 | + - name: Test TGZ Packages |
| 121 | + if: ${{ inputs.type == 'patch' }} |
| 122 | + shell: bash |
| 123 | + run: | |
| 124 | + python3 ./tests/ci/artifactory.py --test-tgz ${{ inputs.dry-run && '--dry-run' || '' }} |
| 125 | + - name: Export RPM Packages |
| 126 | + if: ${{ inputs.type == 'patch' }} |
| 127 | + shell: bash |
| 128 | + run: | |
| 129 | + python3 ./tests/ci/artifactory.py --export-rpm ${{ inputs.dry-run && '--dry-run' || '' }} |
| 130 | + - name: Test RPM Packages |
| 131 | + if: ${{ inputs.type == 'patch' }} |
| 132 | + shell: bash |
| 133 | + run: | |
| 134 | + python3 ./tests/ci/artifactory.py --test-rpm ${{ inputs.dry-run && '--dry-run' || '' }} |
| 135 | + - name: Export Debian Packages |
| 136 | + if: ${{ inputs.type == 'patch' }} |
| 137 | + shell: bash |
| 138 | + run: | |
| 139 | + python3 ./tests/ci/artifactory.py --export-debian ${{ inputs.dry-run && '--dry-run' || '' }} |
| 140 | + - name: Test Debian Packages |
| 141 | + if: ${{ inputs.type == 'patch' }} |
| 142 | + shell: bash |
| 143 | + run: | |
| 144 | + python3 ./tests/ci/artifactory.py --test-debian ${{ inputs.dry-run && '--dry-run' || '' }} |
| 145 | + - name: Docker clickhouse/clickhouse-server building |
| 146 | + if: ${{ inputs.type == 'patch' }} |
| 147 | + shell: bash |
| 148 | + run: | |
| 149 | + python3 ./tests/ci/create_release.py --set-progress-started --progress "docker server release" |
| 150 | + cd "./tests/ci" |
| 151 | + export CHECK_NAME="Docker server image" |
| 152 | + python3 docker_server.py --release-type auto --version ${{ env.RELEASE_TAG }} --check-name "$CHECK_NAME" --sha ${{ env.COMMIT_SHA }} ${{ ! inputs.dry-run && '--push' || '' }} |
| 153 | + python3 ./tests/ci/create_release.py --set-progress-completed |
| 154 | + - name: Docker clickhouse/clickhouse-keeper building |
| 155 | + if: ${{ inputs.type == 'patch' }} |
| 156 | + shell: bash |
| 157 | + run: | |
| 158 | + python3 ./tests/ci/create_release.py --set-progress-started --progress "docker keeper release" |
| 159 | + cd "./tests/ci" |
| 160 | + export CHECK_NAME="Docker keeper image" |
| 161 | + python3 docker_server.py --release-type auto --version ${{ env.RELEASE_TAG }} --check-name "$CHECK_NAME" --sha ${{ env.COMMIT_SHA }} ${{ ! inputs.dry-run && '--push' || '' }} |
| 162 | + python3 ./tests/ci/create_release.py --set-progress-completed |
| 163 | + - name: Set Release progress completed |
| 164 | + shell: bash |
| 165 | + run: | |
| 166 | + # If we here - set completed status, to post proper Slack OK or FAIL message in the next step |
| 167 | + python3 ./tests/ci/create_release.py --set-progress-started --progress "completed" |
| 168 | + python3 ./tests/ci/create_release.py --set-progress-completed |
| 169 | + - name: Post Slack Message |
| 170 | + if: ${{ !cancelled() }} |
| 171 | + shell: bash |
| 172 | + run: | |
| 173 | + python3 ./tests/ci/create_release.py --post-status ${{ inputs.dry-run && '--dry-run' || '' }} |
0 commit comments