diff --git a/.github/workflows/cd-version.yml b/.github/workflows/cd-version.yml new file mode 100644 index 000000000..db7935531 --- /dev/null +++ b/.github/workflows/cd-version.yml @@ -0,0 +1,32 @@ +name: CD Version + +on: [push, pull_request] + +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: yarn lint:version diff --git a/docs/changelogs/1.15.3.md b/docs/changelogs/1.15.3.md index 0b01c692b..c85cc7bf8 100644 --- a/docs/changelogs/1.15.3.md +++ b/docs/changelogs/1.15.3.md @@ -15,6 +15,10 @@ The bot now gets more expressive! - Moved `/credits` to `/about creators` - `/debug` command now ditches embeds and has better information to serve +## Technical Features + +- Added a workflow and lint for package and changelog version miss match + ## Technical Changes - Removed manual trigger for Asian latest ratings leaderboard archiver diff --git a/package.json b/package.json index 4b549bce7..d9c1af04f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "lint": "npx tsc", "lint:website": "next lint", "format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"", + "lint:version": "vite-node --script scripts/checkVersionMissMatch", "knip": "knip", "update": "yarn upgrade --latest" }, diff --git a/scripts/checkVersionMissMatch.ts b/scripts/checkVersionMissMatch.ts new file mode 100644 index 000000000..a13c9351e --- /dev/null +++ b/scripts/checkVersionMissMatch.ts @@ -0,0 +1,12 @@ +import { readdir } from 'fs/promises'; +import packageJSON from '../package.json'; + +const { version } = packageJSON; +const changelogs = await readdir('docs/changelogs'); +const hasVersion = changelogs.includes(`${version}.md`); + +if (hasVersion) { + console.log(`Version ${version} found in changelogs`); +} else { + throw new Error(`Version ${version} not found in changelogs`); +}