forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClickHouse#66593 from ClickHouse/autorelease_poc
CI: POC for Auto Releases
- Loading branch information
Showing
11 changed files
with
921 additions
and
446 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
name: Release | ||
|
||
description: Makes patch releases and creates new release branch | ||
|
||
inputs: | ||
ref: | ||
description: 'Git reference (branch or commit sha) from which to create the release' | ||
required: true | ||
type: string | ||
type: | ||
description: 'The type of release: "new" for a new release or "patch" for a patch release' | ||
required: true | ||
type: choice | ||
options: | ||
- patch | ||
- new | ||
dry-run: | ||
description: 'Dry run' | ||
required: false | ||
default: true | ||
type: boolean | ||
token: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Prepare Release Info | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --prepare-release-info \ | ||
--ref ${{ inputs.ref }} --release-type ${{ inputs.type }} \ | ||
${{ inputs.dry-run && '--dry-run' || '' }} | ||
echo "::group::Release Info" | ||
python3 -m json.tool /tmp/release_info.json | ||
echo "::endgroup::" | ||
release_tag=$(jq -r '.release_tag' /tmp/release_info.json) | ||
commit_sha=$(jq -r '.commit_sha' /tmp/release_info.json) | ||
echo "Release Tag: $release_tag" | ||
echo "RELEASE_TAG=$release_tag" >> "$GITHUB_ENV" | ||
echo "COMMIT_SHA=$commit_sha" >> "$GITHUB_ENV" | ||
- name: Download All Release Artifacts | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --download-packages ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Push Git Tag for the Release | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --push-release-tag ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Push New Release Branch | ||
if: ${{ inputs.type == 'new' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --push-new-release-branch ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Bump CH Version and Update Contributors' List | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --create-bump-version-pr ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Bump Docker versions, Changelog, Security | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --set-progress-started --progress "update ChangeLog" | ||
[ "$(git branch --show-current)" != "master" ] && echo "not on the master" && exit 1 | ||
echo "List versions" | ||
./utils/list-versions/list-versions.sh > ./utils/list-versions/version_date.tsv | ||
echo "Update docker version" | ||
./utils/list-versions/update-docker-version.sh | ||
echo "Generate ChangeLog" | ||
export CI=1 | ||
docker run -u "${UID}:${GID}" -e PYTHONUNBUFFERED=1 -e CI=1 --network=host \ | ||
--volume=".:/ClickHouse" clickhouse/style-test \ | ||
/ClickHouse/tests/ci/changelog.py -v --debug-helpers \ | ||
--gh-user-or-token=${{ inputs.token }} --jobs=5 \ | ||
--output="/ClickHouse/docs/changelogs/${{ env.RELEASE_TAG }}.md" ${{ env.RELEASE_TAG }} | ||
git add ./docs/changelogs/${{ env.RELEASE_TAG }}.md | ||
echo "Generate Security" | ||
python3 ./utils/security-generator/generate_security.py > SECURITY.md | ||
git diff HEAD | ||
- name: Create ChangeLog PR | ||
if: ${{ inputs.type == 'patch' && ! inputs.dry-run }} | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
author: "robot-clickhouse <[email protected]>" | ||
token: ${{ inputs.token }} | ||
committer: "robot-clickhouse <[email protected]>" | ||
commit-message: Update version_date.tsv and changelogs after ${{ env.RELEASE_TAG }} | ||
branch: auto/${{ env.RELEASE_TAG }} | ||
assignees: ${{ github.event.sender.login }} # assign the PR to the tag pusher | ||
delete-branch: true | ||
title: Update version_date.tsv and changelog after ${{ env.RELEASE_TAG }} | ||
labels: do not test | ||
body: | | ||
Update version_date.tsv and changelogs after ${{ env.RELEASE_TAG }} | ||
### Changelog category (leave one): | ||
- Not for changelog (changelog entry is not required) | ||
- name: Reset changes if Dry-run | ||
if: ${{ inputs.dry-run }} | ||
shell: bash | ||
run: | | ||
git reset --hard HEAD | ||
- name: Checkout back to GITHUB_REF | ||
shell: bash | ||
run: | | ||
git checkout "$GITHUB_REF_NAME" | ||
# set current progress to OK | ||
python3 ./tests/ci/create_release.py --set-progress-completed | ||
- name: Create GH Release | ||
shell: bash | ||
if: ${{ inputs.type == 'patch' }} | ||
run: | | ||
python3 ./tests/ci/create_release.py --create-gh-release ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Export TGZ Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --export-tgz ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Test TGZ Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --test-tgz ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Export RPM Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --export-rpm ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Test RPM Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --test-rpm ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Export Debian Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --export-debian ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Test Debian Packages | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/artifactory.py --test-debian ${{ inputs.dry-run && '--dry-run' || '' }} | ||
- name: Docker clickhouse/clickhouse-server building | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --set-progress-started --progress "docker server release" | ||
cd "./tests/ci" | ||
export CHECK_NAME="Docker server image" | ||
python3 docker_server.py --release-type auto --version ${{ env.RELEASE_TAG }} --check-name "$CHECK_NAME" --sha ${{ env.COMMIT_SHA }} ${{ ! inputs.dry-run && '--push' || '' }} | ||
python3 ./tests/ci/create_release.py --set-progress-completed | ||
- name: Docker clickhouse/clickhouse-keeper building | ||
if: ${{ inputs.type == 'patch' }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --set-progress-started --progress "docker keeper release" | ||
cd "./tests/ci" | ||
export CHECK_NAME="Docker keeper image" | ||
python3 docker_server.py --release-type auto --version ${{ env.RELEASE_TAG }} --check-name "$CHECK_NAME" --sha ${{ env.COMMIT_SHA }} ${{ ! inputs.dry-run && '--push' || '' }} | ||
python3 ./tests/ci/create_release.py --set-progress-completed | ||
- name: Set Release progress completed | ||
shell: bash | ||
run: | | ||
# If we here - set completed status, to post proper Slack OK or FAIL message in the next step | ||
python3 ./tests/ci/create_release.py --set-progress-started --progress "completed" | ||
python3 ./tests/ci/create_release.py --set-progress-completed | ||
- name: Post Slack Message | ||
if: ${{ !cancelled() }} | ||
shell: bash | ||
run: | | ||
python3 ./tests/ci/create_release.py --post-status ${{ inputs.dry-run && '--dry-run' || '' }} |
This file contains 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
Oops, something went wrong.