Fetch Histories #388
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fetch Histories | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0,12 * * *' | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "fetch" | |
cancel-in-progress: true | |
env: | |
TURSO_DB_URL: "libsql://zig-jiacai2050.turso.io" | |
TURSO_TOKEN: "${{ secrets.TURSO_TOKEN }}" | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
jobs: | |
fetch: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install deps | |
run: | | |
npm i | |
- name: Update | |
run: | | |
npm run fetch-history | |
build: | |
runs-on: ubuntu-latest | |
needs: fetch | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo | |
key: ${{ runner.os }} | |
- run: | | |
# https://github.com/wilsonzlin/minify-html | |
cargo install minhtml | |
npm i | |
- run: | | |
npm run gen-html | |
minhtml --output web/index.html --keep-closing-tags --minify-css web/raw.html | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: web | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v3 |