mirror of
https://github.com/tiennm99/loldle.git
synced 2026-10-14 16:17:33 +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
@@ -0,0 +1,54 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
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
|
||||
|
||||
- run: pnpm test
|
||||
|
||||
- run: pnpm lint
|
||||
|
||||
# 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
|
||||
@@ -0,0 +1,54 @@
|
||||
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
|
||||
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
|
||||
|
||||
- run: pnpm build
|
||||
env:
|
||||
BASE_PATH: /${{ github.event.repository.name }}
|
||||
|
||||
- uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: web/build
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- id: deployment
|
||||
uses: actions/deploy-pages@v5
|
||||
@@ -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 }}
|
||||
Reference in new issue
Block a user