-
-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (73 loc) · 2.51 KB
/
s3.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
name: AWS S3
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
strategy:
matrix:
target: [COTAK, WFTAK]
include:
- target: COTAK
s3_prod: COTAK_PRODUCTION
s3_staging: COTAK_STAGING
api_url: COTAK_PRODUCTION_API
staging_api_url: COTAK_STAGING_API
- target: WFTAK
s3_prod: WFTAK_PRODUCTION
s3_staging: WFTAK_STAGING
api_url: WFTAK_PRODUCTION_API
staging_api_url: WFTAK_STAGING_API
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha || github.sha}}
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- name: NPM Install
working-directory: ./api/web/
run: npm install
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws-us-gov:iam::${{secrets.AWS_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_REGION}}
- name: NPM Build
working-directory: ./api/web/
run: API_URL='${{ secrets[matrix.api_url] }}' npm run builds3
- name: AWS S3 CP
working-directory: ./api/web/
run: aws s3 cp --recursive dist/ s3://${{ secrets[matrix.s3_prod] }}/${{github.event.pull_request.head.sha || github.sha}}/
- name: Clean Dist
working-directory: ./api/web/
run: rm -rf dist/
- name: Configure AWS Credentials (STAGING)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_STAGING_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_STAGING_REGION}}
- name: NPM Build
working-directory: ./api/web/
run: API_URL='${{ secrets[matrix.staging_api_url] }}' npm run builds3
- name: AWS S3 CP
working-directory: ./api/web/
run: aws s3 cp --recursive dist/ s3://${{ secrets[matrix.s3_staging] }}/${{github.event.pull_request.head.sha || github.sha}}/
- name: Clean Dist
working-directory: ./api/web/
run: rm -rf dist/