-
Notifications
You must be signed in to change notification settings - Fork 12
95 lines (79 loc) · 2.42 KB
/
deploy.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
name: Deploy to ECS
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 14
uses: actions/setup-node@v4
with:
node-version: "14"
cache: "npm"
- name: Install deps
run: |
npm install
npm run build-themes
- name: Update Chrome
run: |
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Run E2E Tests
continue-on-error: true
run: |
npm run e2e:live
- name: Build SSR
run: |
npm run build-prod:ssr
cp dist/frontend/browser/index.html dist/frontend/browser/404.html
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
env:
CLUSTER_NAME: avrae
SERVICE_NAME: avrae-io
DEPLOY_ENV: live
REGION: us-east-1
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AVRAE_GITHUB_OIDC_ROLE_ARN }}
role-session-name: "avrae-io-deploy-live"
aws-region: ${{ env.REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: avrae/${{ env.SERVICE_NAME }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $SERVICE_NAME .
docker tag $SERVICE_NAME $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $SERVICE_NAME $ECR_REGISTRY/$ECR_REPOSITORY:$DEPLOY_ENV
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
- name: Deploy Amazon ECS task definition
run: |
aws ecs update-service --cluster $CLUSTER_NAME-$DEPLOY_ENV --service $SERVICE_NAME --force-new-deployment --region $REGION