ci: generate custom version name for dev + main tags

This commit is contained in:
Joxit 2023-05-24 23:38:06 +02:00
parent 8e98c1c63b
commit e7e762d6d9
No known key found for this signature in database
GPG key ID: F526592B8E012263
5 changed files with 20 additions and 1 deletions

View file

@ -14,10 +14,24 @@ import copyTransform from './rollup/copy-transform.js';
import license from './rollup/license.js';
import checkOutput from './rollup/check-output.js';
import importSVG from './rollup/import-svg.js';
import fs from 'fs';
const version = JSON.parse(fs.readFileSync('./package.json', 'utf-8')).version;
const useServe = process.env.ROLLUP_SERVE === 'true';
const output = useServe ? '.serve' : 'dist';
const getVersion = (version) => {
const parts = version.split('.').map((e) => parseInt(e));
if (useServe || process.env.DEVELOPMENT_BUILD) {
parts[1]++;
parts[2] = 0;
return parts.join('.') + (useServe ? '-dev' : `-${process.env.DEVELOPMENT_BUILD.slice(0, 10)}`);
}
return version;
};
fs.writeFileSync('.version.json', JSON.stringify({ version: getVersion(version) }));
const plugins = [
riot(),
json(),