mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 04:22:03 +00:00
578d22ae94
Automatic style fix Automatic style fix
167 lines
7.6 KiB
YAML
167 lines
7.6 KiB
YAML
name: CreateRelease
|
|
|
|
concurrency:
|
|
group: release
|
|
|
|
'on':
|
|
workflow_dispatch:
|
|
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
|
|
|
|
jobs:
|
|
CreateRelease:
|
|
env:
|
|
GH_TOKEN: ${{ secrets.ROBOT_CLICKHOUSE_COMMIT_TOKEN }}
|
|
runs-on: [self-hosted, release-maker]
|
|
steps:
|
|
- 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
|
|
- name: Check out repository code
|
|
uses: ClickHouse/checkout@v1
|
|
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 }} \
|
|
--outfile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
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
|
|
if: ${{ inputs.type == 'patch' }}
|
|
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' || '' }}
|
|
- 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' || '' }}
|
|
- 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
|
|
if: ${{ inputs.type == 'patch' }}
|
|
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 \
|
|
--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: Generate ChangeLog
|
|
if: ${{ inputs.type == 'patch' && ! inputs.dry-run }}
|
|
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
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/create_release.py --create-gh-release \
|
|
--infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
|
|
- name: Export TGZ Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --export-tgz --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Test TGZ Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --test-tgz --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Export RPM Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --export-rpm --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Test RPM Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --test-rpm --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Export Debian Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --export-debian --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Test Debian Packages
|
|
if: ${{ inputs.type == 'patch' }}
|
|
run: |
|
|
python3 ./tests/ci/artifactory.py --test-debian --infile ${{ env.RELEASE_INFO_FILE }} ${{ inputs.dry-run && '--dry-run' || '' }}
|
|
- name: Docker clickhouse/clickhouse-server building
|
|
if: ${{ inputs.type == 'patch' }}
|
|
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
|
|
if: ${{ inputs.type == 'patch' }}
|
|
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
|
|
if: always()
|
|
run: |
|
|
echo Slack Message
|