Skip to content

set metadata

set metadata #7

name: Nix Flake actions
on:
pull_request:
push:
branches:
- master
- main
jobs:
build:
permissions:
contents: 'read'
id-token: 'write'
packages: 'read'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: 'projects/43005639550/locations/global/workloadIdentityPools/github/providers/github'
service_account: 'github-uploader@www-cartman-fi.iam.gserviceaccount.com'
token_format: 'access_token'
- uses: cachix/install-nix-action@v27
- run: nix build .
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 416.0.0'
skip_install: true
- name: Upload
run: cd result; gsutil -m rsync -d -r . gs://www-cartman-handbook-prod
- name: Set metadata
run: |
gsutil -m setmeta -h "Cache-Control:public, max-age=120, s-maxage=120" -h "Content-Language:en" "gs://www-cartman-handbook-prod/**/*.html" && \
gsutil -m setmeta -h "Cache-Control:public, max-age=7200, s-maxage=7200" "gs://www-cartman-handbook-prod/**/*.css" && \
gsutil -m setmeta -h "Cache-Control:public, max-age=3600, s-maxage=7200" "gs://www-cartman-handbook-prod/**/*.png" || true && \
gsutil -m setmeta -h "Cache-Control:public, max-age=3600, s-maxage=7200" "gs://www-cartman-handbook-prod/**/*.jpg" || true && \
gsutil -m setmeta -h "Cache-Control:public, max-age=3600, s-maxage=7200" "gs://www-cartman-handbook-prod/**/*.svg" || true && \
gsutil -m setmeta -h "Cache-Control:public, max-age=3600, s-maxage=7200" "gs://www-cartman-handbook-prod/**/*.json" || true