Skip to content

v0.1.10

v0.1.10 #15

Workflow file for this run

name: Send publish metrics to bigquery
on:
release:
types: published
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_BQ_METRICS_KEY }}
export_default_credentials: true
- name: Debug event json
run: cat $GITHUB_EVENT_PATH
- name: Check for release key
run: echo "HAS_RELEASE_KEY=$(jq 'has("release")' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
- name: Write release json
if: ${{env.HAS_RELEASE_KEY== 'true'}}
run: 'jq -c ''.release |
{
package_name: .name | split(" ")[0],
name,
tag_name,
version: try(.tag_name | split("-v")[1]),
html_url,
target_commitish,
created_at,
published_at,
draft,
prerelease
}'' $GITHUB_EVENT_PATH > releases.json'
- name: Debug release json
if: ${{env.HAS_RELEASE_KEY== 'true'}}
run: cat releases.json
- name: Send release.json to BQ
if: ${{env.HAS_RELEASE_KEY== 'true'}}
run: bq load --source_format=NEWLINE_DELIMITED_JSON metrics.releases releases.json