-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 1.74 KB
/
assets.yaml
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
name: Assets
on:
workflow_call:
inputs:
ref:
type: string
required: false
account:
description: "Environment to deploy"
type: string
required: true
version:
type: string
required: true
push:
type: boolean
default: false
required: false
concurrency:
group: assets-${{ inputs.account }}
jobs:
build:
name: Build${{ inputs.push && ' and Push' || '' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: app/cdn
env:
ASSET_BUCKET: "vol-app-assets"
ACCOUNT_NUMBER: ${{ vars[inputs.account == 'prod' && 'ACCOUNT_PROD' || 'ACCOUNT_NONPROD'] }}
AWS_OIDC_ROLE: ${{ vars[inputs.account == 'prod' && 'ACCOUNT_PROD_TF_OIDC_ROLE' || 'ACCOUNT_NONPROD_TF_OIDC_ROLE'] }}
AWS_REGION: ${{ vars.DVSA_AWS_REGION }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || null }}
sparse-checkout: app/cdn
fetch-depth: ${{ !inputs.ref && 1 || 0 }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: app/cdn/package.json
- run: npm install --prefer-offline
shell: bash
- run: npm run build:production
shell: bash
- name: Configure AWS credentials
if: ${{ inputs.push }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload assets to CloudFront assets bucket
if: ${{ inputs.push }}
run: aws s3 cp ./public s3://${{ env.ACCOUNT_NUMBER }}-${{ env.ASSET_BUCKET }}/${{ inputs.version }}/ --recursive