dev to main (#237) #621
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |