Skip to content

Build

Build #339

Workflow file for this run

name: "Build"
on:
workflow_dispatch:
schedule:
- cron: '45 3 * * 5' # At 03:45 on Friday
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_API_ENDPOINT: ${{ secrets.R2_API_ENDPOINT }}
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub
permissions:
contents: write
pages: write
id-token: write
jobs:
website:
name: Website
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: endersonmenezes/free-disk-space@6c4664f43348c8c7011b53488d5ca65e9fc5cd1a
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
remove_tool_cache: true
remove_swap: true
remove_packages: "azure-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
remove_packages_one_command: true
remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
testing: false
- name: 🐧 Install dependencies
run: |
sudo apt-get install \
libapp-options-perl \
libdbd-csv-perl \
libdbd-sqlite3-perl \
libencode-perl \
libjson-xs-perl \
libtemplate-perl \
libyaml-libyaml-perl \
rclone \
sqlite3
# https://github.com/marketplace/actions/checkout
- name: 🛎️ Checkout
uses: actions/checkout@v6
# Configure Workload Identity Federation via a credentials file.
- id: auth
name: 🔐 Authenticate to Google Cloud
uses: google-github-actions/auth@v3
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@v3'
# 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 website
run: |
cd build || exit 9
perl site.pl > /dev/null || exit 9
- name: 🧪 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
- name: 🪣 Publish website
#run: gcloud storage cp --gzip-in-flight=html,js,css,txt,json --recursive site/* gs://gcloud-compute.com || exit 9
run: |
mkdir -p "$HOME/.config/rclone" || exit 9
echo "[r2]" > "$HOME/.config/rclone/rclone.conf" || exit 9
echo "type = s3" >> "$HOME/.config/rclone/rclone.conf"
echo "provider = Cloudflare" >> "$HOME/.config/rclone/rclone.conf"
echo "access_key_id = $R2_ACCESS_KEY_ID" >> "$HOME/.config/rclone/rclone.conf"
echo "secret_access_key = $R2_SECRET_ACCESS_KEY" >> "$HOME/.config/rclone/rclone.conf"
echo "endpoint = $R2_API_ENDPOINT" >> "$HOME/.config/rclone/rclone.conf"
echo "acl = private" >> "$HOME/.config/rclone/rclone.conf"
echo "no_check_bucket = true" >> "$HOME/.config/rclone/rclone.conf"
rclone copy --transfers 32 --checkers 64 --fast-list "site/" "r2:gcloud-compute/" || exit 9
- name: Commit last build
run: |
cd build || exit 9
bash commit.sh || exit 9