Repository navigation
80 lines (71 loc) · 2.71 KB
/
Copy pathdeploy-use-ecs.yml
File metadata and controls
80 lines (71 loc) · 2.71 KB
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
name: 🕶️ Deploy Using ECS
run-name: '[${{ inputs.environment }}]: ${{ inputs.acr-region }}-${{ inputs.instance-size }}'
on:
workflow_dispatch:
inputs:
environment:
description: Environment to deploy
required: true
default: staging
type: environment
acr-region:
description: ACR registry
type: choice
default: cn-shenzhen
options:
- cn-shenzhen
- us-east-1
instance-size:
description: ECS instance size
type: string
default: 32c64g
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
push:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
env:
CR: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
steps:
- name: Check client license
env:
CLIENT_LICENSE_TEXT: ${{ secrets.CLIENT_LICENSE_TEXT }}
run: test -n "$CLIENT_LICENSE_TEXT"
- name: Set IMAGE_TAG environment variable
run: echo "IMAGE_TAG=$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV
- name: Set FEATURE environment variable
if: ${{ startsWith(github.event_name == 'schedule' && 'staging' || inputs.environment, 'feature') }}
run: echo "FEATURE=$(echo "${GITHUB_REF#refs/heads/feat/}")" >> "$GITHUB_ENV"
- name: Set US ACR region
if: ${{ inputs.acr-region == 'us-east-1' || inputs.environment == 'prod' || inputs.environment == 'feature prod' }}
run: |
echo "CR=univer-acr-eastus-registry.us-east-1.cr.aliyuncs.com" >> "$GITHUB_ENV"
- uses: peter-evans/repository-dispatch@v4.0.1
with:
token: ${{ secrets.GH_TOKEN }}
repository: dream-num/runner-machine
event-type: create-ci
client-payload: >
{
"service": "documentation",
"git_ref": "${{ github.ref }}",
"image_tag": "${{ env.IMAGE_TAG }}",
"cr": "${{ env.CR }}",
"next_public_docs_source_ref": "${{ github.ref_name }}",
"next_posthog_apikey": "${{ secrets.NEXT_POSTHOG_APIKEY }}",
"client_license_text": ${{ toJSON(secrets.CLIENT_LICENSE_TEXT) }},
"machine": {
"instance_size": "${{ inputs.instance-size }}",
"region": "${{ inputs.acr-region == 'cn-shenzhen' && 'shenzhen' || 'us-virginia' }}",
"internet_bandwidth": "100"
},
"helm_dispatch": {
"event": "${{ vars.DISPATCH_EVENT_TYPE }}",
"service": "univer-docs-site",
"feature": "${{ env.FEATURE }}"
}
}