add weekly ELO rank sync from stat-check.com
- scripts/sync-elo.py: downloads Excel sheet, auto-detects columns, writes public/elo-data.json keyed by lowercase player name - .gitlab-ci.yml: sync-elo stage (schedules only) commits the JSON then a normal push pipeline handles build + deploy; build/deploy skip on scheduled runs to avoid double deployment - index.html + main.js: ELO Rank column with sort support; loads elo-data.json asynchronously and re-renders when ready; fails silently if data is missing Requires one-time setup: 1. GitLab project token (write_repository) stored as GITLAB_PUSH_TOKEN 2. Pipeline schedule: cron 0 2 * * 3 (Wednesday 02:00 UTC) on main Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,26 @@
|
||||
stages:
|
||||
- sync
|
||||
- build
|
||||
- deploy
|
||||
|
||||
# Runs only on scheduled pipelines (every Wednesday via GitLab schedule).
|
||||
# Downloads the stat-check.com ELO Excel sheet, writes public/elo-data.json,
|
||||
# then commits and pushes so a normal build+deploy pipeline picks it up.
|
||||
# Requires CI variable: GITLAB_PUSH_TOKEN (project token, write_repository scope)
|
||||
sync-elo:
|
||||
stage: sync
|
||||
only:
|
||||
- schedules
|
||||
script:
|
||||
- python3 scripts/sync-elo.py
|
||||
- git config user.email "ci@gateway-gamers.net"
|
||||
- git config user.name "GG CI Bot"
|
||||
- git remote set-url origin "https://oauth2:${GITLAB_PUSH_TOKEN}@gl.mando.club/mandalore/40k-rankings.gateway-gamers.net.git"
|
||||
- git add public/elo-data.json
|
||||
- git diff --staged --quiet && echo "No ELO changes." || (git commit -m "sync: update ELO data" && git push origin HEAD:main)
|
||||
|
||||
# Build and deploy skip on scheduled pipelines — the robot push above
|
||||
# triggers its own normal pipeline that handles the actual build + deploy.
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
@@ -13,6 +32,8 @@ build:
|
||||
expire_in: 1 hour
|
||||
only:
|
||||
- main
|
||||
except:
|
||||
- schedules
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
@@ -20,6 +41,8 @@ deploy:
|
||||
- rsync -avz --delete dist/ /var/www/domains/gateway-gamers.net/40k-rankings/
|
||||
only:
|
||||
- main
|
||||
except:
|
||||
- schedules
|
||||
environment:
|
||||
name: production
|
||||
url: https://40k-rankings.gateway-gamers.net
|
||||
|
||||
Reference in New Issue
Block a user