1
0
mirror of synced 2025-12-19 17:48:10 -05:00

Action for new dashboard builder

This commit is contained in:
Simon Cozens
2025-06-25 10:34:22 +01:00
parent 261f0eabaa
commit 20b6e36f6c

View File

@@ -5,12 +5,10 @@ on:
# will run when modifying this file for testing purposes
pull_request:
paths:
- '.github/workflows/report.yaml'
- ".github/workflows/report.yaml"
schedule:
# Every day at 12am
- cron: '0 0 * * *'
- cron: "0 0 * * *"
jobs:
gen_report:
@@ -18,33 +16,82 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Cairo (Ubuntu)
run: sudo apt-get install libcairo2-dev
- name: Install dependencies
run: pip install gftools[qa]
- name: Generate report
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DEV_META_URL: ${{ secrets.DEV_META_URL }}
SANDBOX_META_URL: ${{ secrets.SANDBOX_META_URL }}
PRODUCTION_META_URL: ${{ secrets.PRODUCTION_META_URL }}
run: |
mkdir out
gftools push-stats . out/index.html
gftools compare-meta --meta -o out/meta.html
cp .ci/tags.html out/tags.html
cp .ci/vf-tag-demo2.html out/vf-tag-demo2.html
curl https://fonts.google.com/metadata/fonts > out/family_data.json
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Cairo (Ubuntu)
run: sudo apt-get install libcairo2-dev
- name: Setup requirements
run: pip3 install 'git+https://github.com/googlefonts/gftools'
- name: Setup duckdb
run: curl https://install.duckdb.org | sh
- name: Grab fontspector database
run: |
mkdir -p ~/.ssh/
echo "$CORVEL_SSH_PRIVATE_KEY" > ../private.key
sudo chmod 600 ../private.key
echo "$CORVEL_KNOWNHOSTS" > ~/.ssh/known_hosts
scp -i ../private.key fontspector@corvelsoftware.co.uk:fontspector.db .
shell: bash
env:
CORVEL_SSH_PRIVATE_KEY: ${{secrets.CORVEL_SSH_PRIVATE_KEY}}
CORVEL_KNOWNHOSTS: ${{secrets.CORVEL_KNOWNHOSTS}}
- name: Compact fontspector database
run: |
/home/runner/.duckdb/cli/latest/duckdb fontspector.db -f .ci/dashboard/scripts/tidy-database.sql
- name: Write out secret
run: echo "${{ secrets.GF_PUSH_CONFIG }}" | base64 -d > ~/.gf_push_config.ini
- name: Update servers
run: python3 scripts/update_servers.py
env:
GF_PATH: /home/runner/work/fonts/fonts
working-directory: .ci/dashboard
- uses: stefanzweifel/git-auto-commit-action@v4
name: Commit any updated data files
with:
file_pattern: ".ci/dashboard/src/data/"
# Now build the dashboard
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Generate report
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DEV_META_URL: ${{ secrets.DEV_META_URL }}
SANDBOX_META_URL: ${{ secrets.SANDBOX_META_URL }}
PRODUCTION_META_URL: ${{ secrets.PRODUCTION_META_URL }}
GF_PATH: /home/runner/work/fonts/fonts
GF_REPO_PATH: /home/runner/work/fonts/fonts
run: |
npm run build
gftools compare-meta --meta -o build/meta.html
cp ../tags.html build/tags.html
cp ../vf-tag-demo2.html build/vf-tag-demo2.html
working-directory: .ci/dashboard
- name: Upload build artifacts
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3.0.1
with:
path: .ci/dashboard/build
deploy:
needs: gen_report
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4