mirror of
https://github.com/tiennm99/thptqg.git
synced 2026-10-14 12:17:07 +00:00
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.
92 lines
2.7 KiB
YAML
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
|