1
+ # The Licensed Work is (c) 2022 Sygma
2
+ # SPDX-License-Identifier: LGPL-3.0-only
3
+
4
+ name : spectre_testnet
5
+
6
+ on :
7
+ push :
8
+ branches :
9
+ - main
10
+
11
+ env :
12
+ ENVIRONMENT : ' TESTNET'
13
+ REGISTRY : ' ghcr.io'
14
+ TAG : ' latest'
15
+ AWS_TESTNET : ' ${{ secrets.AWS_ARN }}'
16
+
17
+ jobs :
18
+ push :
19
+ name : push
20
+ runs-on : ubuntu-latest
21
+
22
+ permissions :
23
+ contents : read
24
+ id-token : write
25
+
26
+ steps :
27
+ - name : checkout the source code
28
+ uses : actions/checkout@v3
29
+
30
+ - name : Set up Docker Buildx
31
+ uses : docker/setup-buildx-action@v2
32
+
33
+ - name : login to ghcr
34
+ id : ghcr
35
+ uses : docker/login-action@v2
36
+ with :
37
+ registry : ${{ env.REGISTRY }}
38
+ username : ${{ github.repository_owner }}
39
+ password : ${{ secrets.GHCR_TOKEN }}
40
+
41
+ - name : build / tag / push docker image into ghcr
42
+ id : build-and-push-tag
43
+ uses : docker/build-push-action@v3
44
+ with :
45
+ context : .
46
+ push : true
47
+ tags : ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}
48
+
49
+ # ####################### region 1 ########################
50
+ deploy :
51
+ needs : push
52
+ name : deploy
53
+ runs-on : ubuntu-latest
54
+ strategy :
55
+ matrix :
56
+ spectre_id : [0]
57
+
58
+ permissions :
59
+ contents : read
60
+ id-token : write
61
+
62
+ steps :
63
+ - name : checkout the source code
64
+ uses : actions/checkout@v3
65
+
66
+ - name : checkout ecs repo
67
+ uses : actions/checkout@v3
68
+ with :
69
+ repository : sygmaprotocol/devops
70
+ token : ${{ secrets.GHCR_TOKEN }}
71
+
72
+ - name : render jinja2 templates to task definition json files
73
+
74
+ with :
75
+ template : ' spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
76
+ output_file : ' spectre/spectre-node/ecs/task_definition-${{ matrix.spectre_id }}_${{ env.ENVIRONMENT }}.json'
77
+ data_format : json
78
+ variables : |
79
+ spectreId=${{ matrix.spectre_id }}
80
+ awsAccountId=${{ env.AWS_TESTNET }}
81
+ awsRegion=${{ secrets.AWS_REGION }}
82
+ awsEfs=${{ secrets.SPECTRE_EFS_TESTNET }}
83
+
84
+ - name : configure aws credentials
85
+ uses : aws-actions/configure-aws-credentials@v1
86
+ with :
87
+ role-to-assume : arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
88
+ aws-region : ${{ secrets.AWS_REGION }}
89
+ role-session-name : GithubActions
90
+
91
+ - name : deploy task definition
92
+ uses : aws-actions/amazon-ecs-deploy-task-definition@v1
93
+ with :
94
+ task-definition : ' spectre/spectre-node/ecs/task_definition-${{ matrix.spectre_id }}_${{ env.ENVIRONMENT }}.json'
95
+ service : ' spectre-${{ matrix.spectre_id }}-service-${{ env.ENVIRONMENT }}'
96
+ cluster : ' relayer-${{ env.ENVIRONMENT }}'
97
+ wait-for-service-stability : true
0 commit comments