History #14
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: "History" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '5 8 7,21 * *' # At 08:05 on day-of-month 7 and 21. | |
jobs: | |
website: | |
name: Histroy | |
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@v1 | |
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@v1' | |
# Now you can run gcloud commands authenticated as the impersonated service account. | |
- name: Run | |
run: | | |
cd build || exit 9 | |
bash build.sh || exit 9 | |
bash history.sh || exit 9 | |
# https://cloud.google.com/sdk/gcloud/reference/storage/cp | |
- name: Store | |
run: gcloud storage cp --gzip-in-flight=csv build/costs-*.csv gs://gcloud-compute-history || exit 9 |