improve index #19
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: Nix Flake actions | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- main | |
jobs: | |
build: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 path:. | |
# We're using above, so that we can have access to .git in derivation | |
#- 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 | |
- name: Invalidate CDN cache | |
run: gcloud --project www-cartman-fi compute url-maps invalidate-cdn-cache site --path "/*" --async |