Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Serive worker cache issues #225

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ jobs:
AWS_REGION: "eu-west-1" # optional: defaults to us-east-1
SOURCE_DIR: "dist"

set-index-cache-control:
uses: ./.github/workflows/set-index-cache-control.yml
needs: deploy
if: needs.deploy.result == 'success'
with:
ENVIRONMENT: zetta
VALUE: "no-cache"
secrets: inherit

# Get message VARs and Notify team through discord of deployment
notify:
name: Notify
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ jobs:
AWS_REGION: "eu-west-1" # optional: defaults to us-east-1
SOURCE_DIR: "dist"

set-cache-control:
uses: ./.github/workflows/set-cache-control.yml
set-index-cache-control:
uses: ./.github/workflows/set-index-cache-control.yml
needs: deploy
if: needs.deploy.result == 'success'
with:
ENVIRONMENT: alpha
MAX_AGE: 86400
VALUE: "no-cache"
secrets: inherit

# Get message VARs and Notify team through discord of deployment
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ jobs:
AWS_REGION: "eu-west-1" # optional: defaults to us-east-1
SOURCE_DIR: "dist"

set-cache-control:
uses: ./.github/workflows/set-cache-control.yml
set-index-cache-control:
uses: ./.github/workflows/set-index-cache-control.yml
needs: deploy
if: needs.deploy.result == 'success'
with:
ENVIRONMENT: gamma
MAX_AGE: 86400
VALUE: "no-cache"
secrets: inherit

# Get message VARs and Notify team through discord of deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Set Cache Control
# This workflow is used to set the cache-control header of the app's index.html file
# (which should in general be set to `no-cache`).

name: Set Index Cache Control

on:
workflow_dispatch:
inputs:
MAX_AGE:
VALUE:
required: true
type: number
# eg. "max-age=86400" or "no-cache"
type: string
ENVIRONMENT:
description: "Environment to set the cache control header of index.html"
required: true
Expand All @@ -18,16 +22,16 @@ on:

workflow_call:
inputs:
MAX_AGE:
VALUE:
required: true
type: number
type: string
ENVIRONMENT:
required: true
default: "zetta"
type: string

jobs:
set-cache-control:
set-index-cache-control:
runs-on: ubuntu-latest
steps:
- name: Sets env vars for production
Expand All @@ -50,7 +54,7 @@ jobs:
command: cp
source: ${{ env.AWS_S3_PATH }}
destination: ${{ env.AWS_S3_PATH }}
flags: "--cache-control max-age=${{ inputs.MAX_AGE }}"
flags: "--cache-control ${{ inputs.VALUE }}"
aws_access_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws_region: us-west-1
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default defineConfig({
clientsClaim: true,
skipWaiting: true,
navigateFallbackAllowlist: [/^\//],
maximumFileSizeToCacheInBytes: 1024 * 1024 * 4,
},
includeAssets: [
"favicon.ico",
Expand Down
Loading