From 3c831f4e78e37592bf95177aee17d6da7f72bc25 Mon Sep 17 00:00:00 2001 From: Eric Brelsford Date: Wed, 15 Nov 2023 08:26:38 -0500 Subject: [PATCH] Deploy to staging (#23) * Add router, basic nav * Deploy to S3 with github action * Clear cache --- .github/workflows/deploy-to-s3.yml | 33 ++++++++++++++++++++++++++++++ vacs-map-app/package.json | 1 + 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/deploy-to-s3.yml diff --git a/.github/workflows/deploy-to-s3.yml b/.github/workflows/deploy-to-s3.yml new file mode 100644 index 0000000..8ec52a9 --- /dev/null +++ b/.github/workflows/deploy-to-s3.yml @@ -0,0 +1,33 @@ +on: + workflow_dispatch: + push: + branches: + - main +env: + cloudfront_distribution: ${{ secrets.CLOUDFRONT_DISTRIBUTION }} +jobs: + deploy-to-s3: + name: Deploy to S3 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Build + working-directory: vacs-map-app + run: | + npm install && npm run build-staging + - name: Configure AWS + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Copy to S3 + working-directory: vacs-map-app + run: | + aws s3 sync dist s3://stories2.theplotline.org/vacs/ --delete + - name: Clear Cloudfront cache + run: | + aws cloudfront create-invalidation $cloudfront_distribution --paths '/vacs/*' diff --git a/vacs-map-app/package.json b/vacs-map-app/package.json index ed2f005..1a3ff3d 100644 --- a/vacs-map-app/package.json +++ b/vacs-map-app/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "build-staging": "vite build --base=/vacs/", "preview": "vite preview", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore", "format": "prettier --write src/"