2024-06-27 14:44:00 +00:00
|
|
|
name: CreateRelease
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: release
|
|
|
|
|
|
|
|
'on':
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2024-06-27 17:43:10 +00:00
|
|
|
ref:
|
|
|
|
description: 'Git reference (branch or commit sha) from which to create the release'
|
2024-06-27 14:44:00 +00:00
|
|
|
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
|
2024-07-10 14:19:06 +00:00
|
|
|
- new
|
2024-06-27 17:43:10 +00:00
|
|
|
dry-run:
|
|
|
|
description: 'Dry run'
|
|
|
|
required: false
|
|
|
|
default: true
|
|
|
|
type: boolean
|
2024-06-27 14:44:00 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-06-27 17:43:10 +00:00
|
|
|
CreateRelease:
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.ROBOT_CLICKHOUSE_COMMIT_TOKEN }}
|
|
|
|
runs-on: [self-hosted, release-maker]
|
2024-06-27 14:44:00 +00:00
|
|
|
steps:
|
2024-06-27 17:43:10 +00:00
|
|
|
- name: DebugInfo
|
|
|
|
uses: hmarr/debug-action@f7318c783045ac39ed9bb497e22ce835fdafbfe6
|
|
|
|
- name: Set envs
|
|
|
|
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#multiline-strings
|
|
|
|
run: |
|
|
|
|
cat >> "$GITHUB_ENV" << 'EOF'
|
|
|
|
ROBOT_CLICKHOUSE_SSH_KEY<<RCSK
|
|
|
|
${{secrets.ROBOT_CLICKHOUSE_SSH_KEY}}
|
|
|
|
RCSK
|
|
|
|
RELEASE_INFO_FILE=${{ runner.temp }}/release_info.json
|
|
|
|
EOF
|
2024-06-27 14:44:00 +00:00
|
|
|
- name: Check out repository code
|
|
|
|
uses: ClickHouse/checkout@v1
|
2024-06-27 17:43:10 +00:00
|
|
|
with:
|
|
|
|
token: ${{secrets.ROBOT_CLICKHOUSE_COMMIT_TOKEN}}
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare Release Info
|
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --prepare-release-info \
|
|
|
|
--ref ${{ inputs.ref }} --release-type ${{ inputs.type }} \
|
2024-07-10 19:01:49 +00:00
|
|
|
--outfile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
echo "::group::Release Info"
|
|
|
|
python3 -m json.tool "$RELEASE_INFO_FILE"
|
|
|
|
echo "::endgroup::"
|
|
|
|
release_tag=$(jq -r '.release_tag' "$RELEASE_INFO_FILE")
|
|
|
|
commit_sha=$(jq -r '.commit_sha' "$RELEASE_INFO_FILE")
|
|
|
|
echo "Release Tag: $release_tag"
|
|
|
|
echo "RELEASE_TAG=$release_tag" >> "$GITHUB_ENV"
|
|
|
|
echo "COMMIT_SHA=$commit_sha" >> "$GITHUB_ENV"
|
|
|
|
- name: Download All Release Artifacts
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --infile "$RELEASE_INFO_FILE" --download-packages ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Push Git Tag for the Release
|
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --push-release-tag --infile "$RELEASE_INFO_FILE" ${{ inputs.dry-run && '--dry-run' || '' }}
|
2024-07-10 14:19:06 +00:00
|
|
|
- name: Push New Release Branch
|
|
|
|
if: ${{ inputs.type == 'new' }}
|
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --push-new-release-branch --infile "$RELEASE_INFO_FILE" ${{ inputs.dry-run && '--dry-run' || '' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
- name: Bump CH Version and Update Contributors' List
|
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --create-bump-version-pr --infile "$RELEASE_INFO_FILE" ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Checkout master
|
|
|
|
run: |
|
|
|
|
git checkout master
|
|
|
|
- name: Bump Docker versions, Changelog, Security
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
[ "$(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="$GH_TOKEN" --jobs=5 \
|
2024-07-11 07:24:25 +00:00
|
|
|
--output="/ClickHouse/docs/changelogs/${{ env.RELEASE_TAG }}.md" ${{ env.RELEASE_TAG }}
|
|
|
|
git add ./docs/changelogs/${{ env.RELEASE_TAG }}.md
|
2024-06-27 17:43:10 +00:00
|
|
|
echo "Generate Security"
|
|
|
|
python3 ./utils/security-generator/generate_security.py > SECURITY.md
|
|
|
|
git diff HEAD
|
2024-07-10 14:19:06 +00:00
|
|
|
- name: Generate ChangeLog
|
|
|
|
if: ${{ inputs.type == 'patch' && ! inputs.dry-run }}
|
2024-06-27 17:43:10 +00:00
|
|
|
uses: peter-evans/create-pull-request@v6
|
|
|
|
with:
|
|
|
|
author: "robot-clickhouse <robot-clickhouse@users.noreply.github.com>"
|
|
|
|
token: ${{ secrets.ROBOT_CLICKHOUSE_COMMIT_TOKEN }}
|
|
|
|
committer: "robot-clickhouse <robot-clickhouse@users.noreply.github.com>"
|
|
|
|
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 }}
|
|
|
|
run: |
|
|
|
|
git reset --hard HEAD
|
|
|
|
- name: Checkout back to GITHUB_REF
|
|
|
|
run: |
|
|
|
|
git checkout "$GITHUB_REF_NAME"
|
|
|
|
- name: Create GH Release
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/create_release.py --create-gh-release \
|
|
|
|
--infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
|
|
|
|
- name: Export TGZ Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --export-tgz --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Test TGZ Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --test-tgz --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Export RPM Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --export-rpm --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Test RPM Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --test-rpm --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Export Debian Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --export-debian --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Test Debian Packages
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
python3 ./tests/ci/artifactory.py --test-debian --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Docker clickhouse/clickhouse-server building
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
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' || '' }}
|
|
|
|
- name: Docker clickhouse/clickhouse-keeper building
|
2024-07-10 14:19:06 +00:00
|
|
|
if: ${{ inputs.type == 'patch' }}
|
2024-06-27 17:43:10 +00:00
|
|
|
run: |
|
|
|
|
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' || '' }}
|
|
|
|
- name: Post Slack Message
|
2024-07-10 14:19:06 +00:00
|
|
|
if: always()
|
2024-06-27 14:44:00 +00:00
|
|
|
run: |
|
2024-07-10 14:19:06 +00:00
|
|
|
echo Slack Message
|