fiddle #16
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: Deploy Static Content to S3 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Allows manual triggering of workflow | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build static content | |
run: | | |
echo "PUBLIC_URL = ${PUBLIC_URL}" | |
npm run build | |
env: | |
PUBLIC_URL: /${{ github.sha }} | |
- name: Update base href in index.html | |
run: sed -i "s|<base href=\"/\">|<base href=\"/${{ github.sha }}/\">|" build/index.html | |
- name: Deploy to S3 using AWS CLI | |
run: | | |
echo "Deploying commit ${COMMIT_SHA} to S3..." | |
aws s3 sync build s3://wisp.studio/${COMMIT_SHA} --delete --exclude "fonts/simply-olive/private/*" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: 'us-east-1' | |
COMMIT_SHA: ${{ github.sha }} |