Bib improvements #678
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 site | |
on: | |
push: | |
branches: | |
- main | |
# limit to one concurrent run per PR/branch, | |
# and cancel any previous runs still going | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache image files | |
uses: actions/cache@v3 | |
with: | |
path: public/img | |
key: ${{ runner.os }}-images-${{ hashFiles('src/**/*.png', 'src/**/*.jpe?g', 'src/**/*.gif', 'src/**/*.svg') }} | |
restore-keys: ${{ runner.os }}-images- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'npm' | |
- run: npm install | |
- run: npm run-script build | |
env: | |
CI: true | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- uses: kheiakiyama/install-azcopy-action@d0c8a54798ecf011ec2219ea553196e19a16e7f8 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Upload to blob storage | |
run: azcopy sync public 'https://waystoplay.blob.core.windows.net/$web' --delete-destination=true --compare-hash=MD5 --put-md5=true | |
- name: Set cache-control on fonts/images | |
run: | | |
noHeaderFilter='.[] | select(.properties.contentSettings.cacheControl == null) | .name' | |
export AZURE_STORAGE_AUTH_MODE=login | |
export AZURE_STORAGE_ACCOUNT=waystoplay | |
echo CSS - 1 week | |
blobs=$(az storage blob list --container-name '$web' --prefix css/ | jq -r "$noHeaderFilter") | |
for blob in $blobs; do | |
az storage blob update --container-name '$web' --name "$blob" --content-cache 'max-age=604800' | |
done | |
echo fonts - 6 months | |
blobs=$(az storage blob list --container-name '$web' --prefix fonts/ | jq -r "$noHeaderFilter") | |
for blob in $blobs; do | |
az storage blob update --container-name '$web' --name "$blob" --content-cache 'max-age=15768000' | |
done | |
echo images - 6 months | |
blobs=$(az storage blob list --container-name '$web' --prefix img/ | jq -r "$noHeaderFilter") | |
for blob in $blobs; do | |
az storage blob update --container-name '$web' --name "$blob" --content-cache 'max-age=15768000' | |
done | |
echo small-images - 6 months | |
blobs=$(az storage blob list --container-name '$web' --prefix small-images/ | jq -r "$noHeaderFilter") | |
for blob in $blobs; do | |
az storage blob update --container-name '$web' --name "$blob" --content-cache 'max-age=15768000' | |
done | |
echo audio - 6 months | |
blobs=$(az storage blob list --container-name '$web' --prefix audio/ | jq -r "$noHeaderFilter") | |
for blob in $blobs; do | |
az storage blob update --container-name '$web' --name "$blob" --content-cache 'max-age=15768000' | |
done | |
- name: Purge CDN | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az cdn endpoint purge -g ways-to-play --profile-name ways-to-play-cdn -n waystoplay --content-paths '/*' --no-wait | |
- name: logout | |
run: az logout | |
if: always() |