mirror of
https://github.com/zadam/trilium.git
synced 2026-01-11 17:14:26 +01:00
feat(ci): check version consistency before releasing
This commit is contained in:
parent
0d41cc2660
commit
0b25b09040
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@ -11,6 +11,14 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
sanity-check:
|
||||
name: Sanity Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Check version consistency
|
||||
run: pnpm tsx ${{ github.workspace }}/scripts/check-version-consistency.ts ${{ github.ref_name }}
|
||||
make-electron:
|
||||
name: Make Electron
|
||||
strategy:
|
||||
|
||||
33
scripts/check-version-consistency.ts
Normal file
33
scripts/check-version-consistency.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
const projectRoot = join(__dirname, '..');
|
||||
const filesToCheck = [
|
||||
'package.json',
|
||||
'apps/server/package.json',
|
||||
'apps/client/package.json',
|
||||
'apps/desktop/package.json',
|
||||
'packages/commons/package.json',
|
||||
]
|
||||
|
||||
function main() {
|
||||
const expectedVersion = process.argv[2];
|
||||
if (!expectedVersion) {
|
||||
console.error('Expected version argument is missing.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
for (const fileToCheck of filesToCheck) {
|
||||
const packageJsonPath = join(projectRoot, fileToCheck);
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
||||
const version = packageJson.version;
|
||||
if (version !== expectedVersion) {
|
||||
console.error(`Version mismatch in ${fileToCheck}: expected ${expectedVersion}, found ${version}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('All versions are consistent:', expectedVersion);
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
x
Reference in New Issue
Block a user