-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): update Makefile and CI to adjust release mode (#1627)
* chore(build): update Makefile and CI * chore(build): add script to auto create release tag * refine * chore: add doc * remove -fips suffix * refine * update push token * generate changelog when release * refine --------- Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
17f4b02
commit 270f21d
Showing
9 changed files
with
108 additions
and
146 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,15 +2,14 @@ name: Release | |
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
tags: | ||
- "v*" | ||
- "!v*-alpha" | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_version: v${{ steps.lookup_release_version.outputs.release_version }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
@@ -37,10 +36,7 @@ jobs: | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Lookup release version | ||
id: lookup_release_version | ||
run: | | ||
echo "::set-output name=release_version::$(grep -v '^#' ./release-version)" | ||
- name: Build UI | ||
env: | ||
REACT_APP_MIXPANEL_TOKEN: ${{ secrets.REACT_APP_MIXPANEL_TOKEN }} | ||
|
@@ -50,16 +46,23 @@ jobs: | |
working-directory: ui/packages/tidb-dashboard-for-op/dist | ||
run: | | ||
zip -r ../static-assets.zip . | ||
# TODO: generate changelog | ||
# - name: Generate Changelog | ||
# id: build_changelog | ||
# uses: mikepenz/[email protected] | ||
- name: Create release | ||
id: create_release | ||
uses: fleskesvor/create-release@feature/support-target-commitish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.lookup_release_version.outputs.release_version }} | ||
release_name: Internal Version ${{ steps.lookup_release_version.outputs.release_version }} | ||
tag_name: ${{ github.ref }} | ||
release_name: Internal Version ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
# body: ${{steps.build_changelog.outputs.changelog}} | ||
|
||
- name: Upload UI assets | ||
uses: actions/[email protected] | ||
env: | ||
|
@@ -85,78 +88,3 @@ jobs: | |
asset_path: ./embedded-assets-golang.zip | ||
asset_name: embedded-assets-golang.zip | ||
asset_content_type: application/zip | ||
pd_pr: | ||
if: "!contains(github.event.head_commit.message, 'skip pd_pr')" | ||
name: Create PD PR | ||
runs-on: ubuntu-latest | ||
needs: release | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
branch: [master, release-5.4, release-6.1] | ||
steps: | ||
- name: Check out PD code base | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: tikv/pd | ||
ref: ${{ matrix.branch }} | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
- name: Load go module cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-pd-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-pd- | ||
- name: Update TiDB Dashboard in PD code base | ||
run: | | ||
go get -d "github.com/pingcap/tidb-dashboard@${{ needs.release.outputs.release_version }}" | ||
go mod tidy | ||
make pd-server | ||
go mod tidy | ||
cd tests/client | ||
go mod tidy | ||
cd ../.. | ||
- name: Commit PD code base change | ||
id: git_commit | ||
run: | | ||
git diff | ||
git config user.name "tidb-dashboard-bot" | ||
git config user.email "[email protected]" | ||
git add . | ||
if git status | grep -q "Changes to be committed" | ||
then | ||
git commit --signoff --message "Update TiDB Dashboard to ${{ needs.release.outputs.release_version }}, ref #4257" | ||
echo "::set-output name=committed::1" | ||
else | ||
echo "No changes detected, skipped" | ||
fi | ||
- name: Set build ID | ||
id: build_id | ||
run: echo "::set-output name=id::$(date +%s)" | ||
- name: Create PR based on PD code base | ||
uses: peter-evans/create-pull-request@v3 | ||
if: steps.git_commit.outputs.committed == 1 | ||
with: | ||
token: ${{ secrets.BOT_PAT }} | ||
branch: update-tidb-dashboard/${{ matrix.branch }}-${{ needs.release.outputs.release_version }}-${{ steps.build_id.outputs.id }} | ||
title: Update TiDB Dashboard to ${{ needs.release.outputs.release_version }} [${{ matrix.branch }}] | ||
body: | | ||
### What problem does this PR solve? | ||
Issue Number: ref #4257 | ||
This is an automatic updating PR for TiDB Dashboard. See #4257 for details. | ||
This PR updates TiDB Dashboard to ${{ needs.release.outputs.release_version }} for upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} . | ||
### Release note | ||
```release-note | ||
None | ||
``` | ||
push-to-fork: tidb-dashboard-bot/pd |
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
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
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
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,57 @@ | ||
// This scripts is used to create a new release tag for the current release branch | ||
// when we need to submit a PR to PD for updating the tidb-dashboard. | ||
// After this tag is pushed, it will trigger the CI to build a new tidb-dashboard release version. | ||
// Then we can run the manual-create-pd-pr.yaml workflow in the GitHub to create a PR to PD. | ||
|
||
const { execSync } = require('child_process'); | ||
|
||
function getGitBranch() { | ||
// master, release-7.6 | ||
return execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); | ||
} | ||
|
||
function getGitShortSha() { | ||
// eb69e4fd | ||
return execSync('git rev-parse --short HEAD').toString().trim(); | ||
} | ||
|
||
function getGitLatestTag() { | ||
// v7.6.0-alpha, v7.6.0-<sha>, v7.6.0, v7.6.1-<sha>, v7.6.1 | ||
return execSync('git describe --tags --dirty --always').toString().trim(); | ||
} | ||
|
||
function createReleaseTag() { | ||
const branch = getGitBranch(); | ||
|
||
if (!branch.match(/release-\d.\d$/)) { | ||
console.error('Err: this is not a valid release branch'); | ||
return | ||
} | ||
|
||
const branchVer = branch.replace('release-', ''); | ||
const latestTag = getGitLatestTag().replace('-fips', ''); | ||
|
||
if (!latestTag.startsWith(`v${branchVer}.`)) { | ||
console.error(`Err: latest tag ${latestTag} doesn't match the branch ${branch}, you need to add the new tag manually`); | ||
return | ||
} | ||
|
||
const shortSha = getGitShortSha(); | ||
const splitPos = latestTag.indexOf('-'); | ||
let nextTag = '' | ||
if (splitPos === -1) { | ||
// the latest tag likes v7.6.0, v7.6.1 | ||
// then the next tag should be v7.6.1-<sha> for v7.6.0, v7.6.2-<sha> for v7.6.1 | ||
const suffix = latestTag.replace(`v${branchVer}.`, ''); | ||
nextTag = `v${branchVer}.${parseInt(suffix) + 1}-${shortSha}`; | ||
} else { | ||
// the latest tag likes v7.6.0-<sha>, v7.6.1-<sha> | ||
// then the next tag should be v7.6.0-<sha> for v7.6.0-<sha>, v7.6.1-<sha> for v7.6.1-<sha> | ||
const prefix = latestTag.substring(0, splitPos); | ||
nextTag = `${prefix}-${shortSha}`; | ||
} | ||
execSync(`git tag ${nextTag}`); | ||
console.log(`Created tag ${nextTag}`) | ||
} | ||
|
||
createReleaseTag() |
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
PORT=3001 | ||
PUBLIC_URL='/dashboard' | ||
REACT_APP_VERSION=$npm_package_version | ||
# REACT_APP_RELEASE_VERSION is set in config-overrides.js | ||
REACT_APP_RELEASE_VERSION=unknown | ||
REACT_APP_MIXPANEL_HOST=https://telemetry.pingcap.com/api/v1/dashboard/report | ||
REACT_APP_MIXPANEL_TOKEN= |
Oops, something went wrong.