-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.65 KB
/
deploy_mainnet.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
# The Licensed Work is (c) 2023 Sygma
# SPDX-License-Identifier: LGPL-3.0-only
name: Deploy Spectre on mainnet
on:
workflow_dispatch:
inputs:
release_tag:
description: 'The Release tag Version'
required: true
type: string
run-name: Deploy Spectre Node to Mainnet - ${{ inputs.release_tag }} by @${{ github.actor }}
env:
ENVIRONMENT: MAINNET
REGISTRY: 'ghcr.io'
VERSION: ${{ inputs.release_tag }}
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
environment: mainnet
permissions:
contents: read
id-token: write
actions: write
env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
steps:
- name: Authorised User only
run: |
if [[ ! " mpetrun5 MakMuftic eedygreen " =~ " ${{ github.actor }} " ]]; then
echo "You are not authorized to deploy to mainnet."
exit 1
fi
- name: checkout ecs file
uses: actions/checkout@v4
with:
repository: sygmaprotocol/devops
token: ${{ secrets.GHCR_TOKEN }}
ref: main
- name: render jinja2 templates to task definition json files
uses: cuchi/[email protected]
with:
template: 'spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
output_file: 'spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.json'
data_format: json
variables: |
awsAccountId=${{ env.AWS_MAINNET }}
awsRegion=${{ env.AWS_REGION }}
awsEnv=${{ env.ENVIRONMENT }}
imageTag=${{ env.VERSION }}
awsEfs=${{ secrets.SPECTRE_EFS }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.AWS_MAINNET }}:role/github-actions-${{ env.ENVIRONMENT }}-sygma
aws-region: ${{ env.AWS_REGION }}
role-session-name: GithubActions
- name: Deploy to Amazon ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
with:
task-definition: spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.json
service: spectre-node-service-${{ env.ENVIRONMENT }}
cluster: relayer-${{ env.ENVIRONMENT }}
wait-for-service-stability: true
- name: slack notify
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,job,eventName,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()