forked from web3infra-foundation/mega
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (81 loc) · 2.52 KB
/
mono-engine-deploy.yml
File metadata and controls
91 lines (81 loc) · 2.52 KB
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
name: Mono Engine deploy
on:
push:
branches:
- main
paths-ignore:
- ".devcontainer/**"
- ".github/**"
- "config/**"
- "docker/**"
- "docs/**"
- "extensions/**"
- "moon/**"
- "orion/**"
- "orion-server/**"
- "scorpio/**"
- "scripts/**"
- "tests/**"
env:
AWS_ECS_CLUSTER_NAME: ${{ secrets.AWS_ECS_CLUSTER_NAME }}
AWS_ECS_MONO_SERVICE_NAME: ${{ secrets.AWS_ECS_MONO_SERVICE_NAME }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: ${{ github.repository == 'web3infra-foundation/mega' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build, tag, and push docker image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: m8q5m4u3
REPOSITORY: mega
IMAGE_TAG: mono-0.1.0-pre-release
run: |
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
IMAGE_BASE="$REGISTRY/$REGISTRY_ALIAS/$REPOSITORY"
docker buildx build \
-t $IMAGE_BASE:$IMAGE_TAG \
-t $IMAGE_BASE:$IMAGE_TAG-$TIMESTAMP \
-f ./docker/mono-engine-dockerfile \
--push .
deploy:
if: ${{ github.repository == 'web3infra-foundation/mega' }}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- cluster: gitmega-com
service: mono-engine-dev-service-xnmoxhxb
- cluster: gitmono-com-mega-app
service: mono-engine
steps:
- name: Force ECS redeploy
run: |
aws ecs update-service \
--cluster ${{ matrix.cluster }} \
--service ${{ matrix.service }} \
--force-new-deployment
env:
AWS_REGION: ap-southeast-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}