Dev version based on time

This commit is contained in:
Tim Schaub
2019-09-23 19:24:16 +02:00
parent 60378f2089
commit 5290486e23
2 changed files with 15 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ jobs:
run: npm ci run: npm ci
- name: Publish - name: Publish
run: | run: |
VERSION=$(npx semver $(npm view ol@dev version) --increment prerelease --preid dev) VERSION=$(node tasks/next-dev-version.js)
npm --no-git-tag-version version ${VERSION} npm --no-git-tag-version version ${VERSION}
npm run build-package npm run build-package
cd build/ol cd build/ol

14
tasks/next-dev-version.js Normal file
View File

@@ -0,0 +1,14 @@
const version = require('../package.json').version;
const semver = require('semver');
function nextVersion() {
const s = semver.parse(version);
if (!s) {
throw new Error(`Invalid version ${version}`);
}
return `${s.major}.${s.minor}.${s.patch}-dev.${Date.now()}`;
}
if (require.main === module) {
process.stdout.write(`${nextVersion()}\n`);
}