-
Notifications
You must be signed in to change notification settings - Fork 6
135 lines (118 loc) · 6.59 KB
/
deploy_new_account.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Deploy verifier backend to AWS Environment new account
on:
workflow_run:
workflows: ["Checks"]
branches: ["develop", "main"]
types:
- completed
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
ECR_REPOSITORY: verifier_backend
POLYGON_AMOY_CONTRACT_ADDRESS: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124"
POLYGON_AMOY_SENDER_DID: "did:polygonid:polygon:amoy:2qV9QXdhXXmN5sKjN1YueMjxgRbnJcEGK2kGpvk3cq"
POLYGON_AMOY_NETWORK_FLAG: "0b0001_0011"
POLYGON_AMOY_CHAIN_ID: "80002"
POLYGON_MAIN_CONTRACT_ADDRESS: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D"
POLYGON_MAIN_SENDER_DID: "did:polygonid:polygon:main:2q4Q7F7tM1xpwUTgWivb6TgKX3vWirsE3mqymuYjVv"
POLYGON_MAIN_NETWORK_FLAG: "0b0001_0001"
POLYGON_MAIN_CHAIN_ID: "137"
PRIVADO_MAIN_CONTRACT_ADDRESS: "0x975556428F077dB5877Ea2474D783D6C69233742"
PRIVADO_MAIN_SENDER_DID: "did:iden3:privado:main:2SZz8Kvfb6CXGTiiqNiz8CTFTnySV7PKN7iVUvsNMH"
PRIVADO_MAIN_NETWORK_FLAG: "0b1010_0001"
PRIVADO_MAIN_CHAIN_ID: "21000"
PRIVADO_TEST_CONTRACT_ADDRESS: "0x975556428F077dB5877Ea2474D783D6C69233742"
PRIVADO_TEST_SENDER_DID: "did:iden3:privado:test:2Sn9bnRFiTYNfbS1dVTaGCUXuMfnQMUcTCAXtFv4Gr"
PRIVADO_TEST_NETWORK_FLAG: "0b1010_0010"
PRIVADO_TEST_CHAIN_ID: "21001"
CAMINO_COLUMBUS_CONTRACT_ADDRESS: "0x34eCe5eCe59B978C95147bBa6db8fb62F127e601"
CAMINO_COLUMBUS_NODE_URL: "https://columbus.camino.network/ext/bc/C/rpc"
CAMINO_COLUMBUS_SENDER_DID: "did:polygonid:camino:columbus:3E1DZ5qrNCJctmUS3nphEkfsvqYs1kL5oGTtEpYiov"
CAMINO_COLUMBUS_NETWORK_FLAG: "0b10000011"
CAMINO_COLUMBUS_CHAIN_ID: "501"
jobs:
build-backend:
environment:
name: ${{ github.event.workflow_run.head_branch }}
name: Build and push latest image to AWS
permissions:
id-token: write
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Print Environment
run: echo ${{ github.event.workflow_run.head_branch }}
- name: Build file with supported networks
run: |
echo -e "polygon:" > resolvers_settings.yaml
echo -e " amoy:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_AMOY_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_AMOY_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_AMOY_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " networkFlag: ${{ env.POLYGON_AMOY_NETWORK_FLAG }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_AMOY_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " networkFlag: ${{ env.POLYGON_MAIN_NETWORK_FLAG }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "camino:" >> resolvers_settings.yaml
echo -e " columbus:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.CAMINO_COLUMBUS_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ env.CAMINO_COLUMBUS_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.CAMINO_COLUMBUS_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " networkFlag: ${{ env.CAMINO_COLUMBUS_NETWORK_FLAG }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.CAMINO_COLUMBUS_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "privado:" >> resolvers_settings.yaml
echo -e " test:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_TEST_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_TEST_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_TEST_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " networkFlag: ${{ env.PRIVADO_TEST_NETWORK_FLAG }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_TEST_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " networkFlag: ${{ env.PRIVADO_MAIN_NETWORK_FLAG }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
cat resolvers_settings.yaml
- run: make build/docker
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_NEW }}
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version
- name: Tag and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest