-
Notifications
You must be signed in to change notification settings - Fork 535
feat: add new github action for tidb-operator-release v1.x #6606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ti-chi-bot
merged 7 commits into
pingcap:main
from
lybcodes:featrue/migrate-tidb-operator-release-publish-job
Dec 16, 2025
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
836d979
feat: add new github action for tidb-operator-release v1.x
lybcodes 55eba1f
feat: add new github action for tidb-operator-release v1.x
lybcodes 1ecec0e
feat: add new github action for tidb-operator-publish release v1.x
lybcodes d341e34
feat: add new github action for tidb-operator-publish release v1.x
lybcodes d152484
Apply suggestion from @wuhuizuo
wuhuizuo 035bc47
Apply suggestion from @wuhuizuo
wuhuizuo bb002c5
feat: add new github action for tidb-operator-publish release v1.x
lybcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,95 @@ | ||
| name: Release Charts v1 | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v1.*.*" | ||
| workflow_dispatch: | ||
| inputs: | ||
| git_ref: | ||
| description: 'Branch or commit hash (for v1.x branch)' | ||
| required: true | ||
| type: string | ||
| release_tag: | ||
| description: 'Release tag (empty means the same with GitRef)' | ||
| required: false | ||
| type: string | ||
| br_federation: | ||
| description: 'Whether to release BR federation manager' | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
| fips: | ||
| description: 'Whether to enable FIPS' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| release-charts: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.git_ref || github.ref }} | ||
|
|
||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4 | ||
| with: | ||
| version: '3.14.0' | ||
|
|
||
| - name: Determine release tag and validate | ||
| id: release_tag | ||
| run: | | ||
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
| RELEASE_TAG="${{ github.event.inputs.release_tag }}" | ||
| if [ -z "$RELEASE_TAG" ]; then | ||
| RELEASE_TAG="${{ github.event.inputs.git_ref }}" | ||
| fi | ||
| if [ "${{ github.event.inputs.fips }}" == "true" ]; then | ||
| RELEASE_TAG="${RELEASE_TAG}-fips" | ||
| fi | ||
| BR_FEDERATION="${{ github.event.inputs.br_federation }}" | ||
| if [ -z "$BR_FEDERATION" ]; then | ||
| BR_FEDERATION="true" | ||
| fi | ||
| else | ||
| # push tags | ||
| RELEASE_TAG="${{ github.ref_name }}" | ||
| BR_FEDERATION="true" | ||
| fi | ||
|
|
||
| if [[ ! "$RELEASE_TAG" =~ ^v1\.[0-9]+\.[0-9]+ ]]; then | ||
| echo "Error: Release tag must be v1.x.x format, got: $RELEASE_TAG" | ||
| echo "This workflow is only for v1.x releases. Please use the correct version format." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT | ||
| echo "br_federation=${BR_FEDERATION}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build charts | ||
| env: | ||
| V_RELEASE: ${{ steps.release_tag.outputs.tag }} | ||
| BR_FEDERATION: ${{ steps.release_tag.outputs.br_federation }} | ||
| run: | | ||
| make charts/build | ||
|
|
||
| - name: Update index.yaml | ||
| if: ${{ !contains(steps.release_tag.outputs.tag, 'latest') && !contains(steps.release_tag.outputs.tag, 'nightly') && !contains(steps.release_tag.outputs.tag, 'test') }} | ||
| run: | | ||
| set -e | ||
| CHARTS_BUILD_DIR="output/chart" | ||
| cd ${CHARTS_BUILD_DIR} | ||
| curl -f http://charts.pingcap.org/index.yaml -o index.yaml 2>/dev/null || true | ||
| helm repo index . --url https://charts.pingcap.org/ --merge index.yaml 2>/dev/null || helm repo index . --url https://charts.pingcap.org/ | ||
|
|
||
| - name: Upload all charts and index.yaml to Tencent COS | ||
| uses: sylingd/tencent-cos-and-cdn-action@v1 | ||
| with: | ||
| secret_id: ${{ secrets.TENCENT_COS_SECRET_ID }} | ||
| secret_key: ${{ secrets.TENCENT_COS_SECRET_KEY }} | ||
| cos_bucket: ${{ secrets.TENCENT_COS_BUCKET_NAME }} | ||
|
wuhuizuo marked this conversation as resolved.
Outdated
|
||
| cos_region: ap-beijing | ||
| local_path: ./output/chart | ||
| remote_path: / | ||
This file contains hidden or 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
This file contains hidden or 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,62 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2024 PingCAP, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| ROOT=$(cd $(dirname "${BASH_SOURCE[0]}")/..; pwd -P) | ||
| source $ROOT/hack/lib/vars.sh | ||
|
|
||
| RELEASE_TAG=${V_RELEASE:-"test"} | ||
| CHARTS_BUILD_DIR="output/chart" | ||
| CHART_ITEMS="tidb-operator tidb-drainer tidb-lightning" | ||
| BR_FEDERATION=${BR_FEDERATION:-"true"} | ||
|
|
||
| mkdir -p ${CHARTS_BUILD_DIR} | ||
|
|
||
| # Build charts | ||
| for chartItem in ${CHART_ITEMS}; do | ||
| [ ! -d "charts/${chartItem}" ] && continue | ||
|
|
||
| chartPrefixName="${chartItem}-${RELEASE_TAG}" | ||
|
|
||
| # Update Chart.yaml | ||
| sed -i.bak "s/^version:.*/version: ${RELEASE_TAG}/g" charts/${chartItem}/Chart.yaml | ||
| sed -i.bak "s/^appVersion:.*/appVersion: ${RELEASE_TAG}/g" charts/${chartItem}/Chart.yaml | ||
| rm -f charts/${chartItem}/Chart.yaml.bak | ||
|
|
||
| # Update values.yaml | ||
| sed -i.bak -E "s#pingcap/(tidb-operator|tidb-backup-manager):[^[:space:]]*#pingcap/\\1:${RELEASE_TAG}#g" charts/${chartItem}/values.yaml 2>/dev/null || true | ||
| rm -f charts/${chartItem}/values.yaml.bak 2>/dev/null || true | ||
|
|
||
| # Package chart | ||
| tar -zcf ${CHARTS_BUILD_DIR}/${chartPrefixName}.tgz -C charts ${chartItem} | ||
| sha256sum ${CHARTS_BUILD_DIR}/${chartPrefixName}.tgz > ${CHARTS_BUILD_DIR}/${chartPrefixName}.sha256 | ||
| done | ||
|
|
||
| # Handle br-federation | ||
| if [[ "$BR_FEDERATION" == "true" ]] && [ -d "charts/br-federation" ]; then | ||
| chartItem="br-federation" | ||
| chartPrefixName="${chartItem}-${RELEASE_TAG}" | ||
| sed -i.bak "s/^version:.*/version: ${RELEASE_TAG}/g" charts/${chartItem}/Chart.yaml | ||
| sed -i.bak "s/^appVersion:.*/appVersion: ${RELEASE_TAG}/g" charts/${chartItem}/Chart.yaml | ||
| rm -f charts/${chartItem}/Chart.yaml.bak | ||
| sed -i.bak -E "s#pingcap/br-federation-manager:[^[:space:]]*#pingcap/br-federation-manager:${RELEASE_TAG}#g" charts/${chartItem}/values.yaml | ||
| rm -f charts/${chartItem}/values.yaml.bak | ||
| tar -zcf ${CHARTS_BUILD_DIR}/${chartPrefixName}.tgz -C charts ${chartItem} | ||
| sha256sum ${CHARTS_BUILD_DIR}/${chartPrefixName}.tgz > ${CHARTS_BUILD_DIR}/${chartPrefixName}.sha256 | ||
| fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.