Skip to content

Commit cf0bd8d

Browse files
committed
add upload to s3 step
1 parent d2ac60b commit cf0bd8d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.github/workflows/deploy-ecs-uat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ jobs:
4848
dd-rum-client-token: ${{ secrets.DD_RUM_CLIENT_TOKEN }}
4949
dd-sample-rate: ${{ secrets.DD_SAMPLE_RATE }}
5050
DD_API_KEY: ${{ secrets.DD_API_KEY }}
51+
S3_STATIC_ASSETS_BUCKET_NAME: ${{ secrets.S3_STATIC_ASSETS_BUCKET_NAME }}

.github/workflows/deploy-ecs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ on:
102102
DD_API_KEY:
103103
description: 'Datadog API key'
104104
required: true
105+
S3_STATIC_ASSETS_BUCKET_NAME:
106+
description: 'S3 domain style bucket name for static assets'
107+
required: true
105108

106109
# used to configure IAM to trust Github's OIDC provider
107110
permissions:
@@ -201,6 +204,16 @@ jobs:
201204
ENV_TYPE=${{ inputs.environment }}
202205
ENV_SITE_NAME=${{ inputs.environment-site-name }}
203206
207+
- name: Copy Static Assets from Docker Image and Push to S3
208+
env:
209+
S3_STATIC_ASSETS_BUCKET_NAME: ${{ secrets.S3_STATIC_ASSETS_BUCKET_NAME }}
210+
ECR_REPOSITORY: ${{ inputs.ecr-repository }}
211+
run: |
212+
mkdir -p /tmp/s3static
213+
chmod 777 /tmp/s3static
214+
docker run --rm -v /tmp/s3static:/tmp/s3static $ECR_REPOSITORY:$IMAGE_TAG cp -r ./dist/frontend/. /tmp/s3static
215+
aws s3 sync /tmp/s3static s3://$S3_STATIC_ASSETS_BUCKET_NAME
216+
204217
- name: Deploy Amazon ECS task definition
205218
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
206219
with:

0 commit comments

Comments
 (0)