-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) · 1.66 KB
/
init.yml
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
name: Init
on:
pull_request:
jobs:
setup:
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: oHloc6bC
api_private_key: aba07d40-7f6d-4c2c-8d6e-311639fd6c11
- name: Create cluster
run: |
PROJECT_ID=1372813089454311307
ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }}
cat ${{ matrix.region }}
echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_ENV
echo "CLUSTER_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV
echo "CLUSTER_USER=$(jq '.status.connection_strings.default_user' ${{ matrix.region }})" >> $GITHUB_ENV
echo "CLUSTER_HOST=$(jq '.status.connection_strings.standard.host' ${{ matrix.region }})" >> $GITHUB_ENV
- name: Create branch
run: |
ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }} > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud branch get -c ${{ env.CLUSTER_ID }} -b `cat ${{ matrix.region }} | grep -o 'bran-[a-zA-Z0-9]*'` > ${{ matrix.region }}
cat ${{ matrix.region }}