Files
thptqg/.github/workflows/deploy-pages.yml
T
tiennm99 944ee14b36 chore: merge the 2016 and 2017 lookups into one repository and one Pages site
Each year keeps its full pipeline under its directory; vite bases move to
/thptqg/<year>/ (2017 keeps its old and old2 generations), one deploy
workflow builds both years' databases and bundles behind a root index.
2026-08-13 09:36:56 +07:00

92 lines
2.7 KiB
YAML

name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
2016/tools/xlsxread
2017/tools/xlsxread
- uses: pnpm/action-setup@v4
with:
package_json_file: 2017/package.json
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
cache-dependency-path: |
2016/pnpm-lock.yaml
2017/pnpm-lock.yaml
- name: Build 2016 site
working-directory: '2016'
run: |
set -euo pipefail
cargo build --release --manifest-path tools/xlsxread/Cargo.toml
./tools/xlsxread/target/release/xlsxread build \
--schema tools/xlsxread/configs/thptqg2016-data.toml \
--input data --output public/thptqg2016.db
pnpm install --frozen-lockfile
gzip -k -9 public/thptqg2016.db
pnpm build
rm -f dist/thptqg2016.db
- name: Build 2017 site variants
working-directory: '2017'
run: |
set -euo pipefail
cargo build --release --manifest-path tools/xlsxread/Cargo.toml
./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data.toml --input data --output public/thptqg2017.db
./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data-old.toml --input data-old --output public-old/thptqg2017.db
./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data-old2.toml --input data-old2 --output public-old2/thptqg2017.db
pnpm install --frozen-lockfile
gzip -kf -9 public/thptqg2017.db
gzip -kf -9 public-old/thptqg2017.db
gzip -kf -9 public-old2/thptqg2017.db
pnpm build:all
rm -f dist/thptqg2017.db dist/old/thptqg2017.db dist/old2/thptqg2017.db
- name: Assemble site
run: |
set -euo pipefail
mkdir -p _site
cp index.html _site/
cp -r 2016/dist _site/2016
cp -r 2017/dist _site/2017
- uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4