diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 73e3f7377..8f08eb115 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -28,7 +28,6 @@ jobs: metrics_svg: metrics/plugin/metrics.svg repositories_metrics_svg: metrics/plugin/repositories_metrics.svg followup_svg: metrics/plugin/followup/followup.svg - stargazers_worldmap_svg: metrics/plugin/stargazers/worldmap.svg zi_followup_svg: metrics/plugin/followup/zi_followup.svg wiki_followup_svg: metrics/plugin/followup/wiki_followup.svg f-sy-h_followup_svg: metrics/plugin/followup/f-sy-h_followup.svg @@ -37,37 +36,32 @@ jobs: - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.metrics_svg }} - token: ${{ github.token }} + token: ${{ secrets.METRICS_TOKEN }} + committer_token: ${{ github.token }} user: ${{ github.repository_owner }} committer_branch: metrics base: header + plugins_errors_fatal: yes - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.repositories_metrics_svg }} - token: ${{ github.token }} + token: ${{ secrets.METRICS_TOKEN }} + committer_token: ${{ github.token }} user: ${{ github.repository_owner }} committer_branch: metrics base: repositories - - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 - with: - filename: ${{ env.stargazers_worldmap_svg }} - token: ${{ github.token }} - base: "" - user: ${{ github.repository_owner }} - committer_branch: metrics - plugin_stargazers: true - plugin_stargazers_charts: no - plugin_stargazers_worldmap: yes - plugin_stargazers_worldmap_token: ${{ secrets.GOOGLE_MAP_TOKEN }} + plugins_errors_fatal: yes - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.followup_svg }} - token: ${{ github.token }} + token: ${{ secrets.METRICS_TOKEN }} + committer_token: ${{ github.token }} base: "" user: ${{ github.repository_owner }} committer_branch: metrics plugin_followup: yes plugin_followup_indepth: yes + plugins_errors_fatal: yes - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.zi_followup_svg }} @@ -79,6 +73,7 @@ jobs: committer_branch: metrics repo: zi plugin_followup: yes + plugins_errors_fatal: yes - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.wiki_followup_svg }} @@ -90,6 +85,7 @@ jobs: committer_branch: metrics repo: wiki plugin_followup: yes + plugins_errors_fatal: yes - uses: lowlighter/metrics@65836723097537a54cd8eb90f61839426b4266b6 with: filename: ${{ env.f-sy-h_followup_svg }} @@ -101,3 +97,4 @@ jobs: committer_branch: metrics repo: f-sy-h plugin_followup: yes + plugins_errors_fatal: yes diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 460f78200..3003d8f0c 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,43 +1,118 @@ -# Simple workflow for deploying static content to GitHub Pages +--- name: Deploy static content to Pages on: - # Runs on pushes targeting the default branch push: - branches: ["main"] + branches: [main] + paths: + - .github/workflows/static.yml + - profile/** + workflow_run: + workflows: + - Z Metrics + - Z Reader + - Z PageSpeed Insights + types: [completed] + workflow_dispatch: {} - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: +permissions: {} -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: - group: "pages" + group: pages cancel-in-progress: false jobs: - # Single deploy job since we're just deploying deploy: + if: >- + github.event_name != 'workflow_run' || + github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + timeout-minutes: 10 environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Check out main + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + ref: main + path: main + + - name: Check out generated metrics assets + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + ref: metrics + path: metrics-branch + + - name: Stage curated asset set + env: + SITE: ${{ runner.temp }}/site + run: | + set -euo pipefail + rm -rf "${SITE}" + mkdir -p "${SITE}" + # Organization profile imagery published from main. + if [ -d main/profile/img ]; then + mkdir -p "${SITE}/profile" + cp -R main/profile/img "${SITE}/profile/img" + fi + # Generated metrics SVGs published from the metrics branch. + if [ -d metrics-branch/metrics ]; then + cp -R metrics-branch/metrics "${SITE}/metrics" + fi + # Publish nothing that is not an image or the generated index. + find "${SITE}" -type f \ + ! -name '*.svg' ! -name '*.png' ! -name '*.jpg' \ + ! -name '*.jpeg' ! -name '*.webp' ! -name '*.ico' \ + -print -delete + find "${SITE}" -type d -empty -delete + echo "Staged asset set:" + find "${SITE}" -type f | sort + + - name: Generate index + env: + SITE: ${{ runner.temp }}/site + run: | + set -euo pipefail + { + printf '%s\n' '' + printf '%s\n' '' + printf '%s\n' '
' + printf '%s\n' '' + printf '%s\n' '' + printf '%s\n' 'Generated metrics and organization imagery.
' + printf '%s\n' '