Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 7b6e21b

Browse files
authored
chore: Added deployment pipeline for mainnet (#45)
1 parent 5c81f6e commit 7b6e21b

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

.github/workflows/deploy_mainnet.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Deploy Spectre on mainnet
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'The Release tag Version'
8+
required: true
9+
type: string
10+
11+
12+
env:
13+
AWS_REGION: '${{ secrets.AWS_REGION }}'
14+
ENVIRONMENT: MAINNET
15+
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
16+
REGISTRY: 'ghcr.io'
17+
VERSION: ${{ inputs.release_tag }}
18+
19+
jobs:
20+
deploy:
21+
name: deploy
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: read
26+
id-token: write
27+
actions: write
28+
29+
steps:
30+
- name: Authorised User only
31+
run: |
32+
if [[ ! " mpetrun5 MakMuftic eedygreen " =~ " ${{ github.actor }} " ]]; then
33+
echo "You are not authorized to deploy to mainnet."
34+
exit 1
35+
fi
36+
37+
- name: checkout ecs file
38+
uses: actions/checkout@v4
39+
with:
40+
repository: sygmaprotocol/devops
41+
token: ${{ secrets.GHCR_TOKEN }}
42+
ref: main
43+
44+
- name: render jinja2 templates to task definition json files
45+
uses: cuchi/[email protected]
46+
with:
47+
template: 'spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
48+
output_file: 'spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.json'
49+
data_format: json
50+
variables: |
51+
awsAccountId=${{ env.AWS_MAINNET }}
52+
awsRegion=${{ env.AWS_REGION }}
53+
awsEnv=${{ env.ENVIRONMENT }}
54+
imageTag=${{ env.VERSION }}
55+
awsEfs=${{ secrets.SPECTRE_EFS_MAINNET }}
56+
57+
- name: Configure AWS Credentials
58+
uses: aws-actions/configure-aws-credentials@v4
59+
with:
60+
role-to-assume: arn:aws:iam::${{ env.AWS_MAINNET }}:role/github-actions-${{ env.ENVIRONMENT }}-sygma
61+
aws-region: ${{ env.AWS_REGION }}
62+
role-session-name: GithubActions
63+
64+
- name: Deploy to Amazon ECS
65+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
66+
with:
67+
task-definition: spectre/spectre-node/ecs/task_definition-${{ env.ENVIRONMENT }}.json
68+
service: spectre-service-${{ env.ENVIRONMENT }}
69+
cluster: relayer-${{ env.ENVIRONMENT }}
70+
wait-for-service-stability: true
71+
72+
- name: slack notify
73+
uses: 8398a7/action-slack@v3
74+
with:
75+
status: ${{ job.status }}
76+
fields: repo,message,commit,author,action,job,eventName,ref,workflow
77+
env:
78+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
79+
if: always()
80+

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ COPY --from=builder /spectre ./
1717
RUN chmod +x ./spectre
1818
RUN mkdir -p /mount
1919
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
20-
20+
LABEL org.opencontainers.image.source https://github.com/sygmaprotocol/spectre-node
2121
ENTRYPOINT ["./spectre"]

0 commit comments

Comments
 (0)