1+ name : Deploy
2+
3+ on :
4+ push :
5+ branches : [publisher-staging, publisher-production]
6+
7+ env :
8+ bucket : ' { "staging": "docs.mapbox.com-staging/android/api", "production": "docs.mapbox.com/android/api" }'
9+
10+ jobs :
11+ deploy :
12+ name : Deploy to ${{ matrix.environment }}
13+ runs-on : ubuntu-latest
14+ permissions :
15+ id-token : write
16+ contents : read
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ environment : [staging, production]
21+ exclude :
22+ - environment : ${{ github.ref_name != 'publisher-staging' && 'staging' }}
23+ - environment : ${{ github.ref_name != 'publisher-production' && 'production' }}
24+ steps :
25+ - uses : actions/checkout@v4
26+ with :
27+ submodules : recursive
28+ - uses : actions/setup-node@v4
29+ with :
30+ node-version-file : .nvmrc
31+ cache : ' npm'
32+
33+ - name : Configure AWS Credentials
34+ uses : mapbox/configure-aws-credentials-internal@v5
35+ with :
36+ target-account-id : ${{ vars.AWS_ACCOUNT_ID_DEFAULT }}
37+
38+ - name : Retrieve and configure npm token
39+ uses : mapbox/setup-npm-token@v2
40+
41+ - name : Install npm dependencies
42+ run : npm ci
43+
44+ - name : Build for ${{ matrix.environment }}
45+ run : npm run build
46+ env :
47+ # We don't want this to fail on warnings
48+ CI : false
49+ DEPLOY_ENV : ${{ matrix.environment }}
50+
51+ - name : Sync non-html and json files to ${{ matrix.environment }}
52+ run : aws s3 sync build ${{ env.targetBucket }} --exclude "*.html" --exclude "*.json" --cache-control "max-age=31536000"
53+ env :
54+ targetBucket : s3://${{ fromJson(env.bucket)[matrix.environment] }}
55+
56+ - name : Sync html and json files to ${{ matrix.environment }}
57+ run : aws s3 sync build ${{ env.targetBucket }} --exclude "*" --include "*.html" --include "*.json" --cache-control "max-age=10,stale-while-revalidate=60"
58+ env :
59+ targetBucket : s3://${{ fromJson(env.bucket)[matrix.environment] }}
0 commit comments