forked from pingcap/tidb-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (155 loc) · 5.59 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release
on:
push:
branches:
- release
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
# https://pnpm.io/continuous-integration#github-actions
- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 7
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'pnpm'
cache-dependency-path: 'ui/pnpm-lock.yaml'
- uses: actions/setup-go@v3
with:
go-version: "1.13.5"
- name: Load go module cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
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 }}
run: |
make ui
- name: Pack UI assets for release
working-directory: ui/packages/tidb-dashboard-for-op/dist
run: |
zip -r ../static-assets.zip .
- 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 }}
draft: false
prerelease: false
- name: Upload UI assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ui/packages/tidb-dashboard-for-op/static-assets.zip
asset_name: static-assets.zip
asset_content_type: application/zip
- name: Generate embedded UI assets
run: |
NO_ASSET_BUILD_TAG=1 scripts/embed_ui_assets.sh
cp pkg/uiserver/embedded_assets_handler.go embedded_assets_handler.go
- name: Pack embedded assets for release
run: |
zip -r embedded-assets-golang.zip ./embedded_assets_handler.go
- name: Upload embedded UI assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
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.1"
- 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