Skip to content

Commit

Permalink
edit colorbar width, one more pass at publish-site metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jukent committed Mar 21, 2024
1 parent 7804088 commit 5bdc288
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/get-metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
FOUNDATIONS_ID = '281776420'
COOKBOOKS_ID = '324070631'


# Access Secrets
PRIVATE_KEY_ID = os.environ.get('PRIVATE_KEY_ID')
# Ensure GH secrets doesn't intrudce extra '\' new line characters (related to '\' being an escape character)
Expand Down Expand Up @@ -56,6 +55,8 @@ def _format_rounding(value):
return f'{round(value / 1000, 1):.1f}K'


# The rest of this file alternates between functions for requesting information from Google Analytics
# And functions that use that request image to form either a .json or a .png file to be used in write-metrics-md.py
def _run_total_users_report(property_id):
"""
Function for requesting cumulative active users from a project since project start.
Expand Down Expand Up @@ -289,7 +290,7 @@ def plot_usersXcountry(FOUNDATIONS_ID):
)

# Add colorbar
cax = fig.add_axes([0.1, -0.015, 0.67, 0.03])
cax = fig.add_axes([0.05, -0.015, 0.7, 0.03])
cbar = fig.colorbar(mappable=mappable, cax=cax, spacing='uniform', orientation='horizontal', extend='min')
cbar.set_label('Unique Users')

Expand Down
56 changes: 32 additions & 24 deletions .github/workflows/publish-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,43 @@ on:
jobs:
automate-metrics:
runs-on: macos-latest
uses: actions/checkout@v3
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }}
run: |
python -m venv analytics-api
source analytics-api/bin/activate
pip install google-analytics-data cartopy matplotlib
steps:
- uses: actions/checkout@v3
- name: Automate Metrics
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }}
run: |
python -m venv analytics-api
source analytics-api/bin/activate
pip install google-analytics-data cartopy matplotlib
python .github/workflows/get-metrics.py
python .github/workflows/write-metrics-md.py
python .github/workflows/get-metrics.py
python .github/workflows/write-metrics-md.py
zip-artifact:
uses: actions/upload-artifact@v4
with:
name: repo-w-metrics
path: ./repo.zip
- name: Upload zipped repo artifact
uses: actions/upload-artifact@v4
with:
name: repo-w-metrics
path: ./repo.zip

build:
needs: Automate Metrics
needs: automate-metrics
runs-on: ubuntu-latest
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
with:
environment_file: 'environment.yml'
environment_name: pythia
path_to_notebooks: 'portal'
build_command: 'make -j4 html'
artifact: repo-w-metrics
path: ./repo.zip
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: repo-w-metrics
path: ./repo.zip

- name: Build the Book
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
with:
environment_file: 'environment.yml'
environment_name: pythia
path_to_notebooks: 'portal'
build_command: 'make -j4 html'

deploy:
needs: build
Expand Down

0 comments on commit 5bdc288

Please sign in to comment.