make the parent domain parameterized/dynamic #16
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 a website directory to a private Gen website. | |
on: | |
# allow this workflow to be triggered manually from the GitHub UI | |
workflow_dispatch: | |
# trigger this workflow on every push to `main` | |
push: | |
branches: | |
- main | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- uses: 'actions/checkout@v4' | |
- name: Authenticate with Google Cloud | |
uses: 'google-github-actions/auth@v2.1.3' | |
with: | |
project_id: 'probcomp-caliban' | |
workload_identity_provider: 'projects/110275315150/locations/global/workloadIdentityPools/gen-website-private-publishers/providers/github' | |
service_account: 'gen-website-private-admin@probcomp-caliban.iam.gserviceaccount.com' | |
audience: '//iam.googleapis.com/projects/110275315150/locations/global/workloadIdentityPools/gen-website-private-publishers/providers/github' | |
- name: Deploy to Google Cloud Storage | |
run: | | |
WEBSITE_DIR='./public' | |
PARENT_DOMAIN='gen.dev' | |
SUBDOMAIN=${{github.event.repository.name}} | |
BUCKET_PATH="gs://gen-website-private/$PARENT_DOMAIN/$SUBDOMAIN" | |
gcloud storage rsync --recursive --delete-unmatched-destination-objects --cache-control 'public, max-age=60' $WEBSITE_DIR $BUCKET_PATH |