This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 238
114 lines (98 loc) · 5.75 KB
/
deploy.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
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
name: Deploy
on:
workflow_dispatch:
inputs:
git_commit_id:
description: Git commit SHA1.
type: string
required: true
environment:
description: Name of an environment.
type: choice
options:
- prod-all
- prod-arbitrum
- prod-avalanche
- prod-bsc
- prod-celo
- prod-ethereum
- prod-fantom
- prod-optimism
- prod-polygon
- staging-all
- staging-bsc
- staging-polygon
default: prod-all
jobs:
deploy:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Create configuration
uses: rishabhgupta/split-by@v1
id: conf
with:
string: ${{ inputs.environment }}
split-by: "-"
- name: Create environment variables (ethereum)
run: |
echo "folder_env=${{ steps.conf.outputs._0 }}" >> $GITHUB_ENV
echo "chain=${{ steps.conf.outputs._1 }}" >> $GITHUB_ENV
#
# Make the changes to 0x-main-infra
#
- name: Checkout 0x-main-infra
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
repository: 0xProject/0x-main-infra
- name: Update API configs (Ethereum)
if: env.chain == 'ethereum' || env.chain == 'all'
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/common/*.yml env/0x-api/${{ env.folder_env }}/apis/*.yml
- name: Update API configs (Ethereum Gorli)
if: env.chain == 'ethereum' || (env.chain == 'all' && env.folder_env == 'prod')
run: |
sed -i -e 's/newTag:.*/newTag: ${{ inputs.git_commit_id }}/g' clusters/main-cluster/kubernetes/goerli-api/kustomization.yaml
- name: Update API configs (Arbitrum)
if: env.chain == 'arbitrum' || (env.chain == 'all' && env.folder_env == 'prod')
run: |
sed -i -e 's/newTag:.*/newTag: ${{ inputs.git_commit_id }}/g' clusters/main-cluster/kubernetes/arbitrum-api/kustomization.yaml
- name: Update API configs (BSC)
if: env.chain == 'bsc' || env.chain == 'all'
run: sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/bsc/*.yml
- name: Update API configs (Polygon)
if: env.chain == 'polygon' || env.chain == 'all'
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/polygon/*.yml
- name: Update API configs (Polygon Mumbai)
if: env.chain == 'polygon' || (env.chain == 'all' && env.folder_env == 'prod')
run: |
sed -i -e 's/newTag:.*/newTag: ${{ inputs.git_commit_id }}/g' clusters/main-cluster/kubernetes/mumbai-api/kustomization.yaml
- name: Update API configs (Avalanche) || env.chain == 'all'
if: env.chain == 'avalanche' || (env.chain == 'all' && env.folder_env != 'staging')
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/avalanche/*.yml
- name: Update API configs (Fantom)
if: env.chain == 'fantom' || (env.chain == 'all' && env.folder_env != 'staging')
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/fantom/*.yml
- name: Update API configs (Celo)
if: env.chain == 'celo' || (env.chain == 'all' && env.folder_env != 'staging')
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/celo/*.yml
- name: Update API configs (Optimism)
if: env.chain == 'optimism' || (env.chain == 'all' && env.folder_env != 'staging')
run: |
sed -i -e 's/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:.*"/"883408475785\.dkr\.ecr\.us-east-1\.amazonaws\.com\/0x\/api\:${{ inputs.git_commit_id }}"/g' env/0x-api/${{ env.folder_env }}/apis/optimism/*.yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT }}
author: ${{ github.event.sender.login }} <${{ github.event.sender.login }}@users.noreply.github.com>
commit-message: '0x-api/${{ env.chain }}/${{ env.folder_env }}: Deploy ${{ github.sha }}'
title: '[0xApi][${{ env.chain }}][${{ env.folder_env }}] Deploy ${{ github.sha }}'
branch: '0xApi/${{ env.chain }}/${{ env.folder_env }}/${{ github.sha }}'
body: |
## Automated deploy action
Triggered by @${{ github.event.sender.login }}