From 27017dfa65a4098750dadc61c575c3d8c26333c7 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Thu, 21 Nov 2024 12:11:17 -0700 Subject: [PATCH 1/4] GHA - experiment with deploying to dev-alpha.bloomlibrary.org --- .github/workflows/build-and-deploy.yml | 70 +++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ed1dfbfb..1e883ce0 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -43,10 +43,66 @@ jobs: - name: Run tests run: yarn test:ci - # Not yet - # - name: Deploy to S3 - # run: | - # aws s3 cp path/to/build/artifacts s3://your-bucket-name --recursive - # env: - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Deploy to S3 - non bloomlibrary.org + run: | + if [ "${{ github.ref }}" == "refs/heads/master" ]; then + # Deploy to alpha and dev-alpha for master branch + + # aws s3 rm s3://alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites + # note that we do not have the cache-defeating hash on this + # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache + + aws s3 rm s3://dev-alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + + elif [ "${{ github.ref }}" == "refs/heads/release" ]; then + # Deploy to dev for release branch + + # aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + + elif [ "${{ github.ref }}" == "refs/heads/embed" ]; then + # Deploy to embed for embed branch + + # aws s3 rm s3://embed.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites + # note that we do not have the cache-defeating hash on this + # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache + fi + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} + + - name: Deploy to S3 - bloomlibrary.org + if: github.ref == 'refs/heads/release' + run: | + # aws s3 rm s3://bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # Please keep the --exclude robots.txt at the end of both commands! If published, it will prevent search engines from indexing us. + # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" --exclude "robots.txt" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" --exclude "robots.txt" + + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_SECRET_ACCESS_KEY }} From 7a0281dc78ed6c3203e6957646b4525dfd3080d4 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Thu, 21 Nov 2024 14:20:35 -0700 Subject: [PATCH 2/4] GHA - reorg action to simplify and fix syntax --- .github/workflows/build-and-deploy.yml | 96 ++++++++++++++------------ 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 1e883ce0..f7053e0b 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -43,51 +43,31 @@ jobs: - name: Run tests run: yarn test:ci - - name: Deploy to S3 - non bloomlibrary.org + - name: Deploy to S3 - alpha.bloomlibrary.org + if: github.ref == 'refs/heads/master' run: | - if [ "${{ github.ref }}" == "refs/heads/master" ]; then - # Deploy to alpha and dev-alpha for master branch - - # aws s3 rm s3://alpha.bloomlibrary.org --recursive - # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. - # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" - # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" - # make this version of the script that helps with managing history on embedded sites - # note that we do not have the cache-defeating hash on this - # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache - - aws s3 rm s3://dev-alpha.bloomlibrary.org --recursive - # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. - # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" - # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" - - elif [ "${{ github.ref }}" == "refs/heads/release" ]; then - # Deploy to dev for release branch - - # aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive - # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. - # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" - # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" - - elif [ "${{ github.ref }}" == "refs/heads/embed" ]; then - # Deploy to embed for embed branch + # aws s3 rm s3://alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites + # note that we do not have the cache-defeating hash on this + # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} - # aws s3 rm s3://embed.bloomlibrary.org --recursive - # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. - # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" - # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" - # make this version of the script that helps with managing history on embedded sites - # note that we do not have the cache-defeating hash on this - # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache - fi + - name: Deploy to S3 - dev-alpha.bloomlibrary.org + if: github.ref == 'refs/heads/master' + run: | + aws s3 rm s3://dev-alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" env: AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} @@ -102,7 +82,35 @@ jobs: # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" --exclude "robots.txt" # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" --exclude "robots.txt" - env: AWS_ACCESS_KEY_ID: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_SECRET_ACCESS_KEY }} + + - name: Deploy to S3 - dev.bloomlibrary.org + if: github.ref == 'refs/heads/release' + run: | + # aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} + + - name: Deploy to S3 - embed.bloomlibrary.org + if: github.ref == 'refs/heads/embed' + run: | + # aws s3 rm s3://embed.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. + # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. + # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's + # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites + # note that we do not have the cache-defeating hash on this + # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} From be46f8d3a3f5e0254399c4b8577a35ec95f38cbe Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Thu, 21 Nov 2024 14:33:16 -0700 Subject: [PATCH 3/4] GHA - deploy all sites except bloomlibrary.org --- .github/workflows/build-and-deploy.yml | 34 +++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index f7053e0b..47673b7e 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -46,15 +46,18 @@ jobs: - name: Deploy to S3 - alpha.bloomlibrary.org if: github.ref == 'refs/heads/master' run: | - # aws s3 rm s3://alpha.bloomlibrary.org --recursive + aws s3 rm s3://alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites # note that we do not have the cache-defeating hash on this - # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache + aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache env: AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} @@ -63,9 +66,11 @@ jobs: if: github.ref == 'refs/heads/master' run: | aws s3 rm s3://dev-alpha.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" env: @@ -76,10 +81,12 @@ jobs: if: github.ref == 'refs/heads/release' run: | # aws s3 rm s3://bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. # Please keep the --exclude robots.txt at the end of both commands! If published, it will prevent search engines from indexing us. # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" --exclude "robots.txt" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's # aws s3 cp build s3://bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" --exclude "robots.txt" env: @@ -89,12 +96,14 @@ jobs: - name: Deploy to S3 - dev.bloomlibrary.org if: github.ref == 'refs/heads/release' run: | - # aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" env: AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} @@ -102,15 +111,18 @@ jobs: - name: Deploy to S3 - embed.bloomlibrary.org if: github.ref == 'refs/heads/embed' run: | - # aws s3 rm s3://embed.bloomlibrary.org --recursive + aws s3 rm s3://embed.bloomlibrary.org --recursive + # Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself. # These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced. - # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" + # Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's - # aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" + # make this version of the script that helps with managing history on embedded sites # note that we do not have the cache-defeating hash on this - # aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache + aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache env: AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }} From 334531ce081431ea136cdbec483030286059ea71 Mon Sep 17 00:00:00 2001 From: Steve McConnel Date: Thu, 5 Dec 2024 16:59:29 -0700 Subject: [PATCH 4/4] Replace newlines in titles for better display (BL-13210) --- src/model/Book.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/model/Book.ts b/src/model/Book.ts index c0a0f2a6..673e8ef1 100644 --- a/src/model/Book.ts +++ b/src/model/Book.ts @@ -352,7 +352,8 @@ export class Book { public getBestTitle(langISO?: string): string { const t = langISO ? this.allTitles.get(langISO) : this.title; - return t || this.title; // if we couldn't get this lang out of allTitles, use the official title + // if we couldn't get this lang out of allTitles, use the official title + return (t || this.title).replace(/[\r\n\v]+/g, " "); } // Passed a restrictionType that is one of the field names in IInternetLimits @@ -570,11 +571,12 @@ export function getBestBookTitle( rawAllTitlesJson: string, contextLangTag?: string ): string { - if (!contextLangTag) return defaultTitle; + if (!contextLangTag) return defaultTitle.replace(/[\r\n\v]+/g, " "); // enhance: could we do this faster with just a regular expression? const map = parseAllTitles(rawAllTitlesJson); - return map.get(contextLangTag) || defaultTitle; + const contextTitle = map.get(contextLangTag); + return (contextTitle || defaultTitle).replace(/[\r\n\v]+/g, " "); } export function getBookTitleInLanguageOrUndefined( @@ -583,7 +585,8 @@ export function getBookTitleInLanguageOrUndefined( ): string | undefined { // enhance: could we do this faster with just a regular expression? const map = parseAllTitles(bookInfo.allTitles); - return map.get(contextLangTag); + const contextTitle = map.get(contextLangTag); + return contextTitle?.replace(/[\r\n\v]+/g, " "); } function parseAllTitles(allTitlesString: string): Map {