-
Notifications
You must be signed in to change notification settings - Fork 12
62 lines (55 loc) · 1.98 KB
/
publish.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
name: Publish ACT to S3
# Controls when the action will run.
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [dev, prod]
include:
- environment: dev
accessKey: AWS_ACCESS_KEY_ID
secretAccessKey: AWS_SECRET_ACCESS_KEY
domain: act.staging-speckle.arup.com
distributionId: E371NR2EWLBGAU
- environment: prod
accessKey: PROD_AWS_ACCESS_KEY_ID
secretAccessKey: PROD_AWS_SECRET_ACCESS_KEY
domain: act.speckle.arup.com
distributionId: E2NXBFTPT5D0EV
steps:
- uses: actions/checkout@v2
- name: Use Node.js16
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
env:
VUE_APP_SPECKLE_ID_ARUP: c7b971c70c
VUE_APP_SPECKLE_SECRET_ARUP: ${{ secrets.VUE_APP_SPECKLE_SECRET_ARUP }}
VUE_APP_SPECKLE_ID_XYZ: 6f249d7a6f
VUE_APP_SPECKLE_SECRET_XYZ: ${{ secrets.VUE_APP_SPECKLE_SECRET_XYZ }}
VUE_APP_SPECKLE_ID_CUSTOM: carbon
VUE_APP_SPECKLE_SECRET_CUSTOM: ${{ secrets.VUE_APP_SPECKLE_SECRET_CUSTOM }}
VUE_APP_SPECKLE_NAME: A Carbon Tool
VUE_APP_POSTHOG: ${{ secrets.VUE_APP_POSTHOG }}
- run: npm run test:unit -- --passWithNoTests
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets[matrix.accessKey] }}
aws-secret-access-key: ${{ secrets[matrix.secretAccessKey] }}
aws-region: eu-west-1
- name: Upload to S3
if: github.ref == 'refs/heads/main'
run: |
aws s3 sync --delete dist/ s3://${{ matrix.domain }}-${{ matrix.environment }}
- name: Invalidate Cache
if: github.ref == 'refs/heads/main'
run: |
aws cloudfront create-invalidation --distribution-id ${{ matrix.distributionId }} --paths /index.html