Skip to content

Build

Build #210

Workflow file for this run

name: "Build"
on:
workflow_dispatch:
schedule:
- cron: '45 3 * * 5' # At 03:45 on Friday
jobs:
website:
name: Website
runs-on: ubuntu-latest
# Add "id-token" for Google Authentication
permissions:
id-token: write
steps:
- name: Install dependencies
run: |
sudo apt-get install \
jq \
sqlite3 \
libapp-options-perl \
libencode-perl \
libyaml-libyaml-perl \
libjson-xs-perl \
libdbd-csv-perl \
libdbd-sqlite3-perl \
libtemplate-perl
# https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v4
# Configure Workload Identity Federation via a credentials file.
- id: auth
name: 🔐 Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: 'projects/187514662523/locations/global/workloadIdentityPools/github-com/providers/github-com-oidc'
service_account: 'gh-compute-machine-types@gcloud-compute-344913.iam.gserviceaccount.com'
export_environment_variables: true
# Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`.
- name: '🔧 Set up Google Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
# Now you can run gcloud commands authenticated as the impersonated service account.
- name: Run build script
run: |
cd build || exit 9
bash build.sh || exit 9
- name: Create site
run: |
cd build || exit 9
perl site.pl || exit 9
- name: More tests
run: |
cat "site/europe-west4/n2-standard-8.html" | grep '249' || exit 9
jq -e '.[] | .name' "site/instance_in_region.json" | grep '"n2-standard-8"' || exit 9
# https://cloud.google.com/sdk/gcloud/reference/storage/cp
- name: Deploy
run: gcloud storage cp --gzip-in-flight=html,js,css,txt,json --recursive site/* gs://gcloud-compute.com || exit 9
#run: gsutil -m rsync -d -r site gs://gcloud-compute.com || exit 9