mirror of
https://github.com/tiennm99/loldle.git
synced 2026-10-11 03:13:42 +00:00
chore: wire up monorepo layout after absorbing loldle-data and loldle-android
Workflows move to the repo root: deploy and CI build from web/, and a single update-champions workflow replaces the old two-repo pipeline (scrape in data/, copy into web/static/, redeploy). Go module becomes github.com/tiennm99/loldle/data. Root README maps the three parts.
This commit is contained in:
1 parent
084e5e5e43
commit
c1a209806c
11 files changed
+105
-98
No files matched your search
@@ -15,15 +15,21 @@ concurrency:
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: pnpm/action-setup@v6
|
||||
with:
|
||||
package_json_file: web/package.json
|
||||
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
|
||||
- run: pnpm install --frozen-lockfile --ignore-scripts
|
||||
|
||||
@@ -34,3 +40,15 @@ jobs:
|
||||
# No BASE_PATH here: this checks that the app compiles. The base-path
|
||||
# behaviour is verified against a real preview before release.
|
||||
- run: pnpm build
|
||||
|
||||
scraper:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: data/go.mod
|
||||
|
||||
- run: go build ./... && go test ./...
|
||||
working-directory: data
|
||||
@@ -17,15 +17,21 @@ concurrency:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: pnpm/action-setup@v6
|
||||
with:
|
||||
package_json_file: web/package.json
|
||||
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
|
||||
- run: pnpm install --frozen-lockfile --ignore-scripts
|
||||
|
||||
@@ -35,7 +41,7 @@ jobs:
|
||||
|
||||
- uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: build
|
||||
path: web/build
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Update champions data
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every Thursday at 06:00 UTC (day after Riot's Wednesday patch)
|
||||
- cron: "0 6 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: update-champions
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: data/go.mod
|
||||
|
||||
- name: Run scraper
|
||||
run: go run .
|
||||
working-directory: data
|
||||
|
||||
- name: Copy data into the web app
|
||||
run: cp data/champions.json web/static/champions.json
|
||||
|
||||
- name: Commit and push if changed
|
||||
id: commit
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add data/champions.json data/CHAMPIONS.md web/static/champions.json
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "chore(data): update champions data to latest patch"
|
||||
git push
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# A push made with GITHUB_TOKEN does not trigger other workflows,
|
||||
# so the Pages deploy has to be started explicitly.
|
||||
- name: Trigger deploy
|
||||
if: steps.commit.outputs.changed == 'true'
|
||||
run: gh workflow run deploy.yml --ref main
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
@@ -0,0 +1,17 @@
|
||||
# loldle
|
||||
|
||||
LoLdle-style League of Legends daily champion guessing game — one repository, three parts:
|
||||
|
||||
| Directory | What it is |
|
||||
| --- | --- |
|
||||
| [`web/`](./web/) | The SvelteKit web app, deployed to [tiennm99.github.io/loldle](https://tiennm99.github.io/loldle/) |
|
||||
| [`data/`](./data/) | Go scraper that refreshes `champions.json` weekly from Riot's Data Dragon API |
|
||||
| [`android/`](./android/) | Android client (stub) |
|
||||
|
||||
The `Update champions data` workflow runs the scraper every Thursday, copies the
|
||||
result into `web/static/champions.json`, and redeploys the site when the data
|
||||
changed.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0 — see [LICENSE](./web/LICENSE).
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
name: Update champions data
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every Thursday at 06:00 UTC (day after Riot's Wednesday patch)
|
||||
- cron: "0 6 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Run scraper
|
||||
run: go run .
|
||||
|
||||
- name: Commit and push if changed
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add champions.json CHAMPIONS.md
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "chore: update champions data to latest patch"
|
||||
git push
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# loldle-data
|
||||
|
||||
[LoLdleData](https://github.com/Kerrders/LoLdleData) rewritten in Go — fetches League of Legends champion data from Riot's Data Dragon API and outputs a structured JSON file for use in [loldle](https://github.com/tiennm99/loldle).
|
||||
[LoLdleData](https://github.com/Kerrders/LoLdleData) rewritten in Go — fetches League of Legends champion data from Riot's Data Dragon API and outputs a structured JSON file for use in the web app in [`web/`](../web/).
|
||||
|
||||
## What it extracts
|
||||
|
||||
@@ -44,7 +44,7 @@ A human-readable `CHAMPIONS.md` table is also generated alongside the JSON.
|
||||
|
||||
## Used by
|
||||
|
||||
- [loldle](https://github.com/tiennm99/loldle) — the Wordle-style LoL guessing game that consumes this data.
|
||||
- [`web/`](../web/) — the Wordle-style LoL guessing game that consumes this data.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module github.com/tiennm99/loldle-data
|
||||
module github.com/tiennm99/loldle/data
|
||||
|
||||
go 1.25.5
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"github.com/tiennm99/loldle-data/parser"
|
||||
"github.com/tiennm99/loldle/data/parser"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/tiennm99/loldle-data/parser"
|
||||
"github.com/tiennm99/loldle/data/parser"
|
||||
)
|
||||
|
||||
// saveMarkdown renders champions as a human-readable table matching the
|
||||
|
||||
Vendored
-54
@@ -1,54 +0,0 @@
|
||||
name: Sync champions data
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Thursdays 12:00 UTC, after loldle-data's own 06:00 UTC scrape
|
||||
# (GitHub queues scheduled runs 2-4h late, so leave a wide margin)
|
||||
- cron: '0 12 * * 4'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: sync-data
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
SOURCE_REPO: tiennm99/loldle-data
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Fetch champions.json from loldle-data
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sha=$(gh api "repos/$SOURCE_REPO/commits/main" --jq .sha)
|
||||
gh api "repos/$SOURCE_REPO/contents/champions.json?ref=$sha" \
|
||||
-H "Accept: application/vnd.github.raw" > static/champions.json
|
||||
echo "SOURCE_SHA=${sha:0:7}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Commit if changed
|
||||
id: commit
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if git diff --quiet -- static/champions.json; then
|
||||
echo "static/champions.json already matches loldle-data@$SOURCE_SHA"
|
||||
exit 0
|
||||
fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add static/champions.json
|
||||
git commit -m "chore(data): sync champions from loldle-data@$SOURCE_SHA"
|
||||
git push
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# A push made with GITHUB_TOKEN does not trigger other workflows,
|
||||
# so the Pages deploy has to be started explicitly.
|
||||
- name: Trigger deploy
|
||||
if: steps.commit.outputs.changed == 'true'
|
||||
run: gh workflow run deploy.yml --ref main
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# loldle
|
||||
|
||||
LoLdle-style League of Legends daily champion guessing game — data auto-updated from [loldle-data](https://github.com/tiennm99/loldle-data).
|
||||
LoLdle-style League of Legends daily champion guessing game — data auto-updated by the scraper in [`data/`](../data/).
|
||||
|
||||
Live: https://tiennm99.github.io/loldle/
|
||||
|
||||
|
||||
Reference in new issue
Block a user