From c9e7baf6a109d9ccda74d1e74851f2abeaf89665 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:03:53 -0600 Subject: [PATCH 01/20] first pass at artifact passing --- .github/workflows/nightly-build.yaml | 7 +++++++ .github/workflows/publish-site.yaml | 7 +++++++ .github/workflows/trigger-preview.yaml | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml index 620234a6..3f4f58f8 100644 --- a/.github/workflows/nightly-build.yaml +++ b/.github/workflows/nightly-build.yaml @@ -21,9 +21,16 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py + - uses: actions/upload-artifact@v3 + with: + name: repo-w-metrics + path: '.' build: needs: automate-metrics + uses: actions/download-artifact@v3 + with: + name: repo-w-metrics if: ${{ github.repository_owner == 'ProjectPythia' }} uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index d342d19f..cc362efc 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -23,9 +23,16 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py + - uses: actions/upload-artifact@v3 + with: + name: repo-w-metrics + path: '.' build: needs: automate-metrics + uses: actions/download-artifact@v3 + with: + name: repo-w-metrics uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: environment_file: 'environment.yml' diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index fcd9167b..4c8a32da 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -23,6 +23,10 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py + - uses: actions/upload-artifact@v3 + with: + name: repo-w-metrics + path: '.' find-pull-request: needs: automate-metrics From 530be5a44a372c97b695523b68cb795057507bce Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:05:22 -0600 Subject: [PATCH 02/20] missed one --- .github/workflows/trigger-preview.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index 4c8a32da..958e2706 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -34,6 +34,9 @@ jobs: deploy-preview: needs: find-pull-request if: github.event.workflow_run.conclusion == 'success' + uses: actions/download-artifact@v3 + with: + name: repo-w-metrics uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main with: artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }} From 5106b7f59b7b756f4bcb4c2fdbdc2b4c634085c2 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:37:11 -0600 Subject: [PATCH 03/20] pass 2 --- .github/workflows/nightly-build.yaml | 33 +++++++++++++++----------- .github/workflows/publish-site.yaml | 31 ++++++++++++++---------- .github/workflows/trigger-preview.yaml | 24 ------------------- 3 files changed, 37 insertions(+), 51 deletions(-) diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml index 3f4f58f8..7c5ea40a 100644 --- a/.github/workflows/nightly-build.yaml +++ b/.github/workflows/nightly-build.yaml @@ -21,23 +21,28 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py - - uses: actions/upload-artifact@v3 - with: - name: repo-w-metrics - path: '.' + - name: Upload zipped repo artifact + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip build: needs: automate-metrics - uses: actions/download-artifact@v3 - with: - name: repo-w-metrics - if: ${{ github.repository_owner == 'ProjectPythia' }} - 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' + steps: + upload-artifact: # Assuming this is the step name on line 33 (adjust if different) + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip + build: + if: ${{ github.repository_owner == 'ProjectPythia' }} + 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' link-check: if: ${{ github.repository_owner == 'ProjectPythia' }} diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index cc362efc..a334879f 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -23,22 +23,27 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py - - uses: actions/upload-artifact@v3 - with: - name: repo-w-metrics - path: '.' + - name: Upload zipped repo artifact + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip build: needs: automate-metrics - uses: actions/download-artifact@v3 - with: - name: repo-w-metrics - 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' + steps: + upload-artifact: # Assuming this is the step name on line 33 (adjust if different) + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip + build: + 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 diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index 958e2706..05463fcf 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -8,35 +8,11 @@ on: - completed jobs: - automate-metrics: - runs-on: macos-latest - 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 - - uses: actions/upload-artifact@v3 - with: - name: repo-w-metrics - path: '.' - find-pull-request: - needs: automate-metrics uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main deploy-preview: needs: find-pull-request if: github.event.workflow_run.conclusion == 'success' - uses: actions/download-artifact@v3 - with: - name: repo-w-metrics uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main with: artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }} From 315c76ba0b2e66dac0dd902afe3af786f0dd80ba Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:49:52 -0600 Subject: [PATCH 04/20] revert changes to nightly-build (to not deploy or get metrics), and schedule publish weekly --- .github/workflows/nightly-build.yaml | 50 ++++------------------------ .github/workflows/publish-site.yaml | 2 ++ 2 files changed, 9 insertions(+), 43 deletions(-) diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml index 7c5ea40a..f2ab7753 100644 --- a/.github/workflows/nightly-build.yaml +++ b/.github/workflows/nightly-build.yaml @@ -6,53 +6,17 @@ on: - cron: '0 0 * * *' # Daily “At 00:00” jobs: - automate-metrics: - runs-on: macos-latest - 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 - - name: Upload zipped repo artifact - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip - build: - needs: automate-metrics - steps: - upload-artifact: # Assuming this is the step name on line 33 (adjust if different) - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip - build: - if: ${{ github.repository_owner == 'ProjectPythia' }} - 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' + if: ${{ github.repository_owner == 'ProjectPythia' }} + 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' link-check: if: ${{ github.repository_owner == 'ProjectPythia' }} uses: ./.github/workflows/sphinx-link-checker.yaml with: path_to_source: 'portal' - - deploy: - needs: build - uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main - with: - cname: projectpythia.org - publish_dir: 'portal/_build/html' diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index a334879f..afcce733 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -6,6 +6,8 @@ on: branches: - main workflow_dispatch: + schedule: + - cron: '0 0 * * 1' # Weekly on Monday jobs: automate-metrics: From bf828c46f2e7121fc84d8e8224ef9d69a4962705 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 23:45:02 -0600 Subject: [PATCH 05/20] rename build step --- .github/workflows/publish-site.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index afcce733..ff5c590d 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -31,7 +31,7 @@ jobs: name: repo-w-metrics path: ./repo.zip - build: + grab-and-build: needs: automate-metrics steps: upload-artifact: # Assuming this is the step name on line 33 (adjust if different) From 2449155d622035c438c8adeed251d7a0f3e9818b Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 20 Mar 2024 23:54:10 -0600 Subject: [PATCH 06/20] reorder --- .github/workflows/publish-site.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index ff5c590d..8bd3129f 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -31,15 +31,16 @@ jobs: name: repo-w-metrics path: ./repo.zip - grab-and-build: - needs: automate-metrics + build: + needs: Automate Metrics + runs-on: ubuntu-latest # Assuming Ubuntu, adjust as needed steps: - upload-artifact: # Assuming this is the step name on line 33 (adjust if different) - uses: actions/upload-artifact@v4 + - name: Download artifact + uses: actions/download-artifact@v3 with: name: repo-w-metrics path: ./repo.zip - build: + - name: Build the Book # Simplified for clarity uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: environment_file: 'environment.yml' From 78040881381a99ceecbeaa0256f17805868578f0 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:02:08 -0600 Subject: [PATCH 07/20] new placeholder code --- .github/workflows/publish-site.yaml | 56 +++++++++++++---------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 8bd3129f..8884dfae 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -12,41 +12,35 @@ on: jobs: automate-metrics: runs-on: macos-latest - 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 + 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 - python .github/workflows/get-metrics.py - python .github/workflows/write-metrics-md.py - - name: Upload zipped repo artifact - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip + 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 build: needs: Automate Metrics - runs-on: ubuntu-latest # Assuming Ubuntu, adjust as needed - steps: - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: repo-w-metrics - path: ./repo.zip - - name: Build the Book # Simplified for clarity - 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' + 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 deploy: needs: build From 5bdc28838af8ae9ccc1c0c02b6c4d92162679b48 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:33:52 -0600 Subject: [PATCH 08/20] edit colorbar width, one more pass at publish-site metrics --- .github/workflows/get-metrics.py | 5 +-- .github/workflows/publish-site.yaml | 56 ++++++++++++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/get-metrics.py b/.github/workflows/get-metrics.py index c8123e57..78c342f8 100644 --- a/.github/workflows/get-metrics.py +++ b/.github/workflows/get-metrics.py @@ -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) @@ -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. @@ -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') diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 8884dfae..d79f3cde 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -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 From df27a32a26c16d5eb3c62893a21500f8fb8f6727 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:58:22 -0600 Subject: [PATCH 09/20] does download of artifact happen inside build action? --- .github/workflows/publish-site.yaml | 55 ++++++++++++----------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index d79f3cde..d3516856 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -12,43 +12,34 @@ on: jobs: automate-metrics: runs-on: macos-latest - 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 + 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 - 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 - - name: Upload zipped repo artifact - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip + zip-repo: + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip build: needs: automate-metrics - runs-on: ubuntu-latest - 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' + 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' + build_from_code_artifact: true + code_artifact_name: repo-w-metrics deploy: needs: build From 5a13bdae2510edc52fa706f47bc18e42d3fd3087 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:00:10 -0600 Subject: [PATCH 10/20] revert changes to automate metrics step --- .github/workflows/publish-site.yaml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index d3516856..50c2318d 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -12,17 +12,19 @@ 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-repo: uses: actions/upload-artifact@v4 From 4966b5fe112328de962d4317aecc60b0adf67901 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:02:40 -0600 Subject: [PATCH 11/20] fix zip job --- .github/workflows/publish-site.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 50c2318d..2e2c0178 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -26,11 +26,13 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py - zip-repo: - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip +zip-repo: + steps: + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip build: needs: automate-metrics From 01927e709224b4550b668d8d4b73eb5d4418a9f0 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:03:33 -0600 Subject: [PATCH 12/20] oops indent --- .github/workflows/publish-site.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 2e2c0178..46476f35 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -26,13 +26,13 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py -zip-repo: - steps: - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: repo-w-metrics - path: ./repo.zip + zip-repo: + steps: + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: ./repo.zip build: needs: automate-metrics From b993a7930efa59a644b06bb5673c9b419445af16 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:05:18 -0600 Subject: [PATCH 13/20] zip needs runs on, but then will it lose the metrics files? --- .github/workflows/publish-site.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 46476f35..487e82a4 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -27,6 +27,8 @@ jobs: python .github/workflows/write-metrics-md.py zip-repo: + needs: automate-metrics + runs-on: macos-latest steps: - name: Upload artifact uses: actions/upload-artifact@v4 @@ -35,7 +37,7 @@ jobs: path: ./repo.zip build: - needs: automate-metrics + needs: zip-repo uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: environment_file: 'environment.yml' From b135376d5dc56c70755eb36563f2efb74dcdd2fb Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:49:56 -0600 Subject: [PATCH 14/20] add zip step --- .github/workflows/get-metrics.py | 2 +- .github/workflows/publish-site.yaml | 14 +++++++++++--- .gitignore | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/get-metrics.py b/.github/workflows/get-metrics.py index 78c342f8..10b3dfbc 100644 --- a/.github/workflows/get-metrics.py +++ b/.github/workflows/get-metrics.py @@ -290,7 +290,7 @@ def plot_usersXcountry(FOUNDATIONS_ID): ) # Add colorbar - cax = fig.add_axes([0.05, -0.015, 0.7, 0.03]) + cax = fig.add_axes([0.05, -0.015, 0.7, 0.03]) # [x0, y0, width, height] cbar = fig.colorbar(mappable=mappable, cax=cax, spacing='uniform', orientation='horizontal', extend='min') cbar.set_label('Unique Users') diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 487e82a4..70a5d046 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -25,8 +25,16 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py + - name: Zip the book + run: | + set -x + set -e + if [ -f book.zip ]; then + rm -rf book.zip + fi + zip -r repo.zip . - zip-repo: + upload-zip: needs: automate-metrics runs-on: macos-latest steps: @@ -34,10 +42,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: repo-w-metrics - path: ./repo.zip + path: repo.zip build: - needs: zip-repo + needs: upload-zip uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: environment_file: 'environment.yml' diff --git a/.gitignore b/.gitignore index 4fb65167..fdf3a8eb 100644 --- a/.gitignore +++ b/.gitignore @@ -141,5 +141,5 @@ resource-gallery-submission-input.json # Analytics .github/workflows/analytics-api/ -.github/workflows/*.json -.github/workflows/*.png +portal/metrics/*.png +cisl-viast-pythia-*.json From b10a4a574828eda03e367e27fd05d16813bf97b2 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:52:23 -0600 Subject: [PATCH 15/20] rename --- .github/workflows/publish-site.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index 70a5d046..da72395b 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -25,12 +25,12 @@ jobs: python .github/workflows/get-metrics.py python .github/workflows/write-metrics-md.py - - name: Zip the book + - name: Zip the repo run: | set -x set -e - if [ -f book.zip ]; then - rm -rf book.zip + if [ -f repo.zip ]; then + rm -rf repo.zip fi zip -r repo.zip . From b2b70b67094c59d6772791f1604986558a89d3f4 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:57:36 -0600 Subject: [PATCH 16/20] add automate metrics back to trigger-preview --- .github/workflows/trigger-preview.yaml | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index 05463fcf..870f368d 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -8,8 +8,44 @@ on: - completed jobs: + automate-metrics: + runs-on: macos-latest + 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 + - name: Zip the repo + run: | + set -x + set -e + if [ -f repo.zip ]; then + rm -rf repo.zip + fi + zip -r repo.zip . + + upload-zip: + needs: automate-metrics + runs-on: macos-latest + steps: + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: repo-w-metrics + path: repo.zip + find-pull-request: + needs: upload-zip uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main + deploy-preview: needs: find-pull-request if: github.event.workflow_run.conclusion == 'success' From a1630520ecbeab7b2e94f7a1a06e85f634d6189f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:34:35 -0600 Subject: [PATCH 17/20] make strings --- .github/workflows/publish-site.yaml | 8 ++++---- .github/workflows/trigger-preview.yaml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-site.yaml b/.github/workflows/publish-site.yaml index da72395b..af2939e5 100644 --- a/.github/workflows/publish-site.yaml +++ b/.github/workflows/publish-site.yaml @@ -41,8 +41,8 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: repo-w-metrics - path: repo.zip + name: 'repo-w-metrics' + path: 'repo.zip' build: needs: upload-zip @@ -52,8 +52,8 @@ jobs: environment_name: pythia path_to_notebooks: 'portal' build_command: 'make -j4 html' - build_from_code_artifact: true - code_artifact_name: repo-w-metrics + build_from_code_artifact: 'true' + code_artifact_name: 'repo-w-metrics' deploy: needs: build diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index 870f368d..b8d0318f 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -39,8 +39,8 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: repo-w-metrics - path: repo.zip + name: 'repo-w-metrics' + path: 'repo.zip' find-pull-request: needs: upload-zip From bd38a4d69a3243960fa0cb3e105bbbfb26ff4d08 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:00:20 -0600 Subject: [PATCH 18/20] placeholder triggerbookbuild.yaml file --- .github/workflows/trigger-book-build.yaml | 18 ++++++++++++ .github/workflows/trigger-preview.yaml | 35 ----------------------- 2 files changed, 18 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/trigger-book-build.yaml diff --git a/.github/workflows/trigger-book-build.yaml b/.github/workflows/trigger-book-build.yaml new file mode 100644 index 00000000..bf0ce4d6 --- /dev/null +++ b/.github/workflows/trigger-book-build.yaml @@ -0,0 +1,18 @@ +name: trigger-book-build +on: + workflow_call: + inputs: + code_artifact_name: + description: 'Artifact of the repository after automate-metrics has run.' + required: true + default: 'repo-zip' + type: string + +jobs: + build: + uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main + with: + environment_name: pythia-book-dev + artifact_name: book-zip-${{ github.event.number }} + code_artifact_name: {{ code_artifact_name }} + # Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml index b8d0318f..f914d8b2 100644 --- a/.github/workflows/trigger-preview.yaml +++ b/.github/workflows/trigger-preview.yaml @@ -8,42 +8,7 @@ on: - completed jobs: - automate-metrics: - runs-on: macos-latest - 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 - - name: Zip the repo - run: | - set -x - set -e - if [ -f repo.zip ]; then - rm -rf repo.zip - fi - zip -r repo.zip . - - upload-zip: - needs: automate-metrics - runs-on: macos-latest - steps: - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: 'repo-w-metrics' - path: 'repo.zip' - find-pull-request: - needs: upload-zip uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main deploy-preview: From fd7a2fcd39081df11002588641eb7bd72b416be5 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:03:04 -0600 Subject: [PATCH 19/20] fix inputs --- .github/workflows/trigger-book-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger-book-build.yaml b/.github/workflows/trigger-book-build.yaml index bf0ce4d6..55e1ce4c 100644 --- a/.github/workflows/trigger-book-build.yaml +++ b/.github/workflows/trigger-book-build.yaml @@ -14,5 +14,5 @@ jobs: with: environment_name: pythia-book-dev artifact_name: book-zip-${{ github.event.number }} - code_artifact_name: {{ code_artifact_name }} + code_artifact_name: {{ inputs.code_artifact_name }} # Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml From 2f8e5da74dbefe3993f1cb9457fde615d28ecd4d Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:07:12 -0600 Subject: [PATCH 20/20] rm curly brackets --- .github/workflows/trigger-book-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger-book-build.yaml b/.github/workflows/trigger-book-build.yaml index 55e1ce4c..c4dad427 100644 --- a/.github/workflows/trigger-book-build.yaml +++ b/.github/workflows/trigger-book-build.yaml @@ -14,5 +14,5 @@ jobs: with: environment_name: pythia-book-dev artifact_name: book-zip-${{ github.event.number }} - code_artifact_name: {{ inputs.code_artifact_name }} + code_artifact_name: inputs.code_artifact_name # Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml