From 2447d663fa91fec36bede57a47bf5412b69e3629 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 14 Jul 2023 17:14:53 +0000 Subject: [PATCH 1/5] fix: use na region --- .github/workflows/cd-ratings-leaderboard-na.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-ratings-leaderboard-na.yml b/.github/workflows/cd-ratings-leaderboard-na.yml index 01d668990..323cd31b8 100644 --- a/.github/workflows/cd-ratings-leaderboard-na.yml +++ b/.github/workflows/cd-ratings-leaderboard-na.yml @@ -18,4 +18,4 @@ jobs: node-version: 18 - name: Generate leaderboard - run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=asia + run: GH_TOKEN=${{ secrets.GH_TOKEN }} yarn publish:ratingsleaderboard --region=na From 3f081a55770b002b2a0d0c5e5838257e6d20c10f Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 14 Jul 2023 17:16:51 +0000 Subject: [PATCH 2/5] fix: install dependencies --- .github/workflows/cd-docs.yml | 8 ++------ .github/workflows/cd-host.yml | 5 +---- .github/workflows/cd-ratings-leaderboard-na.yml | 15 ++++++++++++++- .github/workflows/ci-build.yml | 6 +----- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index 0141cef17..4dffb3fc0 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -16,18 +16,14 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - strategy: - matrix: - node-version: [18.x] - steps: - - name: Get code + - name: Checkout uses: actions/checkout@v3 - name: Use node uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: 'npm' - name: Install Yarn diff --git a/.github/workflows/cd-host.yml b/.github/workflows/cd-host.yml index 8ed9ceb7b..066510672 100644 --- a/.github/workflows/cd-host.yml +++ b/.github/workflows/cd-host.yml @@ -12,15 +12,12 @@ concurrency: jobs: host: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] steps: - name: Use node uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} + node-version: 18 - name: Download release assets run: | diff --git a/.github/workflows/cd-ratings-leaderboard-na.yml b/.github/workflows/cd-ratings-leaderboard-na.yml index 323cd31b8..32a3c2c7e 100644 --- a/.github/workflows/cd-ratings-leaderboard-na.yml +++ b/.github/workflows/cd-ratings-leaderboard-na.yml @@ -9,13 +9,26 @@ jobs: runs-on: ubuntu-latest steps: - - name: Get code + - 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 diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 156d57820..18a7f4427 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -11,10 +11,6 @@ jobs: name: Build runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] - steps: - name: Checkout uses: actions/checkout@v3 @@ -22,7 +18,7 @@ jobs: - name: Use node uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: 'npm' - name: Install Yarn From 4e0f0536fa769f9f509652699e8a59825511f44c Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 14 Jul 2023 17:27:57 +0000 Subject: [PATCH 3/5] feat: added separate latest and leaderboards for all regions --- .github/workflows/cd-asia-ratings-latest.yml | 34 +++++++++++++++++++ .../cd-asia-ratings-leaderboards.yml | 34 +++++++++++++++++++ .github/workflows/cd-eu-ratings-latest.yml | 34 +++++++++++++++++++ .../workflows/cd-eu-ratings-leaderboards.yml | 34 +++++++++++++++++++ .github/workflows/cd-na-ratings-latest.yml | 34 +++++++++++++++++++ ...-na.yml => cd-na-ratings-leaderboards.yml} | 2 +- scripts/generateRatingsLeaderboard.js | 19 +++++++---- 7 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/cd-asia-ratings-latest.yml create mode 100644 .github/workflows/cd-asia-ratings-leaderboards.yml create mode 100644 .github/workflows/cd-eu-ratings-latest.yml create mode 100644 .github/workflows/cd-eu-ratings-leaderboards.yml create mode 100644 .github/workflows/cd-na-ratings-latest.yml rename .github/workflows/{cd-ratings-leaderboard-na.yml => cd-na-ratings-leaderboards.yml} (94%) diff --git a/.github/workflows/cd-asia-ratings-latest.yml b/.github/workflows/cd-asia-ratings-latest.yml new file mode 100644 index 000000000..e1ebeae35 --- /dev/null +++ b/.github/workflows/cd-asia-ratings-latest.yml @@ -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 diff --git a/.github/workflows/cd-asia-ratings-leaderboards.yml b/.github/workflows/cd-asia-ratings-leaderboards.yml new file mode 100644 index 000000000..a36164a29 --- /dev/null +++ b/.github/workflows/cd-asia-ratings-leaderboards.yml @@ -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 diff --git a/.github/workflows/cd-eu-ratings-latest.yml b/.github/workflows/cd-eu-ratings-latest.yml new file mode 100644 index 000000000..62171b2a9 --- /dev/null +++ b/.github/workflows/cd-eu-ratings-latest.yml @@ -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 diff --git a/.github/workflows/cd-eu-ratings-leaderboards.yml b/.github/workflows/cd-eu-ratings-leaderboards.yml new file mode 100644 index 000000000..ffab76388 --- /dev/null +++ b/.github/workflows/cd-eu-ratings-leaderboards.yml @@ -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 diff --git a/.github/workflows/cd-na-ratings-latest.yml b/.github/workflows/cd-na-ratings-latest.yml new file mode 100644 index 000000000..ff7ab3470 --- /dev/null +++ b/.github/workflows/cd-na-ratings-latest.yml @@ -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 diff --git a/.github/workflows/cd-ratings-leaderboard-na.yml b/.github/workflows/cd-na-ratings-leaderboards.yml similarity index 94% rename from .github/workflows/cd-ratings-leaderboard-na.yml rename to .github/workflows/cd-na-ratings-leaderboards.yml index 32a3c2c7e..414e143a3 100644 --- a/.github/workflows/cd-ratings-leaderboard-na.yml +++ b/.github/workflows/cd-na-ratings-leaderboards.yml @@ -1,4 +1,4 @@ -name: CD Ratings Leaderboard North America +name: CD North America Ratings Leaderboards on: schedule: diff --git a/scripts/generateRatingsLeaderboard.js b/scripts/generateRatingsLeaderboard.js index e1d4c59c1..b39f732dd 100644 --- a/scripts/generateRatingsLeaderboard.js +++ b/scripts/generateRatingsLeaderboard.js @@ -4,12 +4,17 @@ import { argv, env } from 'process'; import commitMultipleFiles from './commitMultipleFiles.js'; /* -For Central North American Time (UTC-5), use 0 5 * * *. -For Central European Time (UTC+1), use 0 23 * * *. -For Central Asia Standard Time (UTC+7), use 0 17 * * *. -*/ + * Central North American Time (UTC-5): use 0 5 * * *. + * Central European Time (UTC+1): use 0 23 * * *. + * 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 latest = argv.includes('--latest'); const server = argv.find((arg) => arg.startsWith('--region='))?.split('=')[1]; if (!server) throw new Error('Region parameter not specified'); @@ -96,8 +101,10 @@ if (publish) { const time = Math.round(Date.now() / 1000); const normalizedServer = server === 'na' ? 'com' : server; - const infoPath = `${normalizedServer}/ratings/seasons/${info.current_season}.json`; - const leaderboardPath = `${normalizedServer}/ratings/leaderboards/${info.current_season}/${time}.json`; + const infoPath = `${normalizedServer}/ratings/${info.current_season}/info.json`; + const leaderboardPath = `${normalizedServer}/ratings/${info.current_season}/${ + latest ? 'latest.json' : `leaderboards/${time}.json` + }`; const infoJSON = JSON.stringify(info); console.log(`Publishing to season ${info.current_season}...`); From 5ded0f8744756c700262b89f0b6ce46f6a4d8769 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 14 Jul 2023 17:31:05 +0000 Subject: [PATCH 4/5] feat: changelogs --- docs/changelogs/1.10.2.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 docs/changelogs/1.10.2.md diff --git a/docs/changelogs/1.10.2.md b/docs/changelogs/1.10.2.md new file mode 100644 index 000000000..38b24e44e --- /dev/null +++ b/docs/changelogs/1.10.2.md @@ -0,0 +1,9 @@ +# Blitzkrieg 1.10.2 + +The experiment in Blitzkrieg `1.10.1` was a bit of a failure so here are a few changes. + +## Fixes + +- North American leaderboards are now saved in the `na` directory instead of `asia` +- Dependencies are now installed before the script is ran +- Added leaderboards for all regions diff --git a/package.json b/package.json index 7a8020c04..510aef5a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blitzkrieg", - "version": "1.10.0", + "version": "1.10.2", "description": "", "main": "src/server.ts", "type": "module", From 18a3e3092ca3d03312d6594ab022501dbd34a1a0 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 14 Jul 2023 17:35:51 +0000 Subject: [PATCH 5/5] fix: gave all regions their own cron times --- .github/workflows/cd-asia-ratings-leaderboards.yml | 2 +- .github/workflows/cd-eu-ratings-leaderboards.yml | 2 +- docs/changelogs/1.10.2.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-asia-ratings-leaderboards.yml b/.github/workflows/cd-asia-ratings-leaderboards.yml index a36164a29..cba5f0734 100644 --- a/.github/workflows/cd-asia-ratings-leaderboards.yml +++ b/.github/workflows/cd-asia-ratings-leaderboards.yml @@ -2,7 +2,7 @@ name: CD North America Ratings Leaderboards on: schedule: - - cron: '0 5 * * *' + - cron: '0 17 * * *' jobs: host: diff --git a/.github/workflows/cd-eu-ratings-leaderboards.yml b/.github/workflows/cd-eu-ratings-leaderboards.yml index ffab76388..293a6365d 100644 --- a/.github/workflows/cd-eu-ratings-leaderboards.yml +++ b/.github/workflows/cd-eu-ratings-leaderboards.yml @@ -2,7 +2,7 @@ name: CD North America Ratings Leaderboards on: schedule: - - cron: '0 5 * * *' + - cron: '0 23 * * *' jobs: host: diff --git a/docs/changelogs/1.10.2.md b/docs/changelogs/1.10.2.md index 38b24e44e..df1ef1637 100644 --- a/docs/changelogs/1.10.2.md +++ b/docs/changelogs/1.10.2.md @@ -7,3 +7,4 @@ The experiment in Blitzkrieg `1.10.1` was a bit of a failure so here are a few c - North American leaderboards are now saved in the `na` directory instead of `asia` - Dependencies are now installed before the script is ran - Added leaderboards for all regions +- All regions now have their own separate cron timings