Fixed the fails

This commit is contained in:
Core 2022-05-02 05:15:22 +01:00
parent b0c4240c17
commit 6940c8bf7e
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
2 changed files with 28 additions and 30 deletions

View file

@ -6,7 +6,7 @@ executors:
- image: circleci/node:16 - image: circleci/node:16
working_directory: ~/Cider working_directory: ~/Cider
orbs: # adds orbs to your configuration orbs: # Add orbs to your configuration
jira: circleci/jira@1.0.5 # invokes the Jira orb, making its commands accessible jira: circleci/jira@1.0.5 # invokes the Jira orb, making its commands accessible
# The jobs for this project # The jobs for this project

View file

@ -1,5 +1,3 @@
if (!process.env['CIRCLECI']) { if (!process.env['CIRCLECI']) {
console.log(`[CIRCLECI SCRIPT] CircleCI not found... Aborting script`) console.log(`[CIRCLECI SCRIPT] CircleCI not found... Aborting script`)
return return
@ -8,10 +6,8 @@ if (!process.env['CIRCLECI']) {
let fs = require('fs') let fs = require('fs')
var data = fs.readFileSync('package.json'); const data = fs.readFileSync('package.json');
var package = JSON.parse(data); const pkg = JSON.parse(data.toString());
let channel; let channel;
if (process.env['CIRCLE_BRANCH'] === 'lts') { if (process.env['CIRCLE_BRANCH'] === 'lts') {
@ -25,29 +21,31 @@ if (process.env['CIRCLE_BRANCH'] === 'lts') {
} }
if (channel.concat('/')) {
channel.replace('/', '-')
}
// https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables // https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
var pvers = package.version.split('.') const version = pkg.version.split('.');
package.version = `${pvers[0]}.${pvers[1]}.${pvers[2]}-${channel}.${process.env['CIRCLE_BUILD_NUM']}` pkg.version = `${version[0]}.${version[1]}.${version[2]}-${channel}.${process.env['CIRCLE_BUILD_NUM']}`
// package.build.channel = channel // package.build.channel = channel
package.publish = { pkg.publish = {
"provider": "github", "provider": "github",
"repo": "cider-releases", "repo": "cider-releases",
"owner": "ciderapp", "owner": "ciderapp",
"vPrefixedTagName": true, "vPrefixedTagName": true,
"tag": `v${package.version}`, "tag": `v${pkg.version}`,
"channel": channel, "channel": channel,
"releaseType": "release" "releaseType": "release"
} }
let {exec} = require('child_process') let {exec} = require('child_process')
exec('echo $APP_VERSION', {env: {'APP_VERSION': package.version}}, function (error, stdout, stderr) exec('echo $APP_VERSION', {env: {'APP_VERSION': pkg.version}}, function (error, stdout, stderr) {
{
console.log(stdout, stderr, error); console.log(stdout, stderr, error);
}); });
fs.writeFile('package.json', JSON.stringify(package), err => { fs.writeFile('package.json', JSON.stringify(pkg), err => {
// error checking // error checking
if(err) throw err; if (err) throw err;
console.log(`VERSION CHANGED TO ${package.version}`); console.log(`VERSION CHANGED TO ${pkg.version}`);
}); });