diff --git a/2017/.github/workflows/deploy.yml b/.github/workflows/deploy-pages.yml
similarity index 53%
rename from 2017/.github/workflows/deploy.yml
rename to .github/workflows/deploy-pages.yml
index 5f7849f..f37762e 100644
--- a/2017/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -24,45 +24,61 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
- workspaces: tools/xlsxread
+ 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 xlsxread binary
- run: cargo build --release --manifest-path tools/xlsxread/Cargo.toml
-
- - name: Install dependencies
- run: pnpm install --frozen-lockfile
-
- - name: Build all databases
+ - 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
-
- - name: Compress databases
- run: |
+ 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: Build all site variants
- run: pnpm build:all
-
- - name: Drop uncompressed DB files from dist
+ - name: Assemble site
run: |
- rm -f dist/thptqg2017.db
- rm -f dist/old/thptqg2017.db
- rm -f dist/old2/thptqg2017.db
+ 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: dist
+ path: _site
deploy:
needs: build
diff --git a/2016/.github/workflows/deploy.yml b/2016/.github/workflows/deploy.yml
deleted file mode 100644
index 9d9fb6d..0000000
--- a/2016/.github/workflows/deploy.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-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: tools/xlsxread
-
- - name: Build xlsxread binary
- run: cargo build --release --manifest-path tools/xlsxread/Cargo.toml
-
- - name: Build database
- run: >
- ./tools/xlsxread/target/release/xlsxread build
- --schema tools/xlsxread/configs/thptqg2016-data.toml
- --input data
- --output public/thptqg2016.db
-
- - uses: pnpm/action-setup@v4
-
- - uses: actions/setup-node@v4
- with:
- node-version: '24'
- cache: 'pnpm'
-
- - name: Install dependencies
- run: pnpm install --frozen-lockfile
-
- - name: Compress database
- run: gzip -k -9 public/thptqg2016.db
-
- - name: Build site
- run: pnpm build
-
- - name: Remove uncompressed db from dist
- run: rm -f dist/thptqg2016.db
-
- - uses: actions/upload-pages-artifact@v3
- with:
- path: dist
-
- 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
diff --git a/2016/README.md b/2016/README.md
index 7ba96f6..a086341 100644
--- a/2016/README.md
+++ b/2016/README.md
@@ -14,7 +14,7 @@ Fully static app running entirely in the browser (SQLite via `sql.js`). No backe
## Demo
-
Tra cứu điểm thi tốt nghiệp THPT Quốc gia theo số báo danh — truy vấn SQL + chạy hoàn toàn trên trình duyệt (sql.js).
+