mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: added separate latest and leaderboards for all regions
This commit is contained in:
1 parent
3f081a5577
commit
4e0f0536fa
7 files changed
+184
-7
No files matched your search
@@ -0,0 +1,34 @@
|
|||||||
|
name: CD North America Ratings Latest
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install --location=global yarn
|
||||||
|
|
||||||
|
- name: Use node_modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate leaderboard
|
||||||
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=asia --latest
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
name: CD North America Ratings Leaderboards
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 5 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install --location=global yarn
|
||||||
|
|
||||||
|
- name: Use node_modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate leaderboard
|
||||||
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=asia
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
name: CD North America Ratings Latest
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install --location=global yarn
|
||||||
|
|
||||||
|
- name: Use node_modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate leaderboard
|
||||||
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=eu --latest
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
name: CD North America Ratings Leaderboards
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 5 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install --location=global yarn
|
||||||
|
|
||||||
|
- name: Use node_modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate leaderboard
|
||||||
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=eu
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
name: CD North America Ratings Latest
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install --location=global yarn
|
||||||
|
|
||||||
|
- name: Use node_modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate leaderboard
|
||||||
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=na --latest
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
name: CD Ratings Leaderboard North America
|
name: CD North America Ratings Leaderboards
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
@@ -4,12 +4,17 @@ import { argv, env } from 'process';
|
|||||||
import commitMultipleFiles from './commitMultipleFiles.js';
|
import commitMultipleFiles from './commitMultipleFiles.js';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For Central North American Time (UTC-5), use 0 5 * * *.
|
* Central North American Time (UTC-5): use 0 5 * * *.
|
||||||
For Central European Time (UTC+1), use 0 23 * * *.
|
* Central European Time (UTC+1): use 0 23 * * *.
|
||||||
For Central Asia Standard Time (UTC+7), use 0 17 * * *.
|
* Central Asia Standard Time (UTC+7): use 0 17 * * *.
|
||||||
*/
|
*
|
||||||
|
* :region/ratings/:season/info.json: season info like rewards, start & end time, etc.
|
||||||
|
* :region/ratings/:season/latest.json: the absolute latest leaderboard recorded at UTC+0 midnight
|
||||||
|
* :region/ratings/:season/leaderboards/:time.json: collection of all recorded leaderboards at local midnights
|
||||||
|
*/
|
||||||
|
|
||||||
const publish = argv.includes('--publish');
|
const publish = argv.includes('--publish');
|
||||||
|
const latest = argv.includes('--latest');
|
||||||
const server = argv.find((arg) => arg.startsWith('--region='))?.split('=')[1];
|
const server = argv.find((arg) => arg.startsWith('--region='))?.split('=')[1];
|
||||||
|
|
||||||
if (!server) throw new Error('Region parameter not specified');
|
if (!server) throw new Error('Region parameter not specified');
|
||||||
@@ -96,8 +101,10 @@ if (publish) {
|
|||||||
const time = Math.round(Date.now() / 1000);
|
const time = Math.round(Date.now() / 1000);
|
||||||
const normalizedServer = server === 'na' ? 'com' : server;
|
const normalizedServer = server === 'na' ? 'com' : server;
|
||||||
|
|
||||||
const infoPath = `${normalizedServer}/ratings/seasons/${info.current_season}.json`;
|
const infoPath = `${normalizedServer}/ratings/${info.current_season}/info.json`;
|
||||||
const leaderboardPath = `${normalizedServer}/ratings/leaderboards/${info.current_season}/${time}.json`;
|
const leaderboardPath = `${normalizedServer}/ratings/${info.current_season}/${
|
||||||
|
latest ? 'latest.json' : `leaderboards/${time}.json`
|
||||||
|
}`;
|
||||||
const infoJSON = JSON.stringify(info);
|
const infoJSON = JSON.stringify(info);
|
||||||
|
|
||||||
console.log(`Publishing to season ${info.current_season}...`);
|
console.log(`Publishing to season ${info.current_season}...`);
|
||||||
|
|||||||
Reference in new issue
Block a user