Fixed the fails
This commit is contained in:
parent
b0c4240c17
commit
6940c8bf7e
2 changed files with 28 additions and 30 deletions
|
@ -6,7 +6,7 @@ executors:
|
|||
- image: circleci/node:16
|
||||
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
|
||||
|
||||
# The jobs for this project
|
||||
|
|
|
@ -1,53 +1,51 @@
|
|||
|
||||
|
||||
if (!process.env['CIRCLECI']) {
|
||||
console.log(`[CIRCLECI SCRIPT] CircleCI not found... Aborting script`)
|
||||
return
|
||||
console.log(`[CIRCLECI SCRIPT] CircleCI not found... Aborting script`)
|
||||
return
|
||||
}
|
||||
|
||||
let fs = require('fs')
|
||||
|
||||
|
||||
var data = fs.readFileSync('package.json');
|
||||
var package = JSON.parse(data);
|
||||
|
||||
|
||||
const data = fs.readFileSync('package.json');
|
||||
const pkg = JSON.parse(data.toString());
|
||||
|
||||
let channel;
|
||||
if (process.env['CIRCLE_BRANCH'] === 'lts') {
|
||||
channel = 'latest'
|
||||
channel = 'latest'
|
||||
} else if (process.env['CIRCLE_BRANCH'] === 'main') {
|
||||
channel = 'beta'
|
||||
channel = 'beta'
|
||||
} else if (process.env['CIRCLE_BRANCH'] === 'develop') {
|
||||
channel = 'alpha'
|
||||
channel = 'alpha'
|
||||
} else {
|
||||
channel = process.env['CIRCLE_BRANCH'] // It won't have auto update support
|
||||
channel = process.env['CIRCLE_BRANCH'] // It won't have auto update support
|
||||
}
|
||||
|
||||
|
||||
if (channel.concat('/')) {
|
||||
channel.replace('/', '-')
|
||||
}
|
||||
|
||||
// https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
|
||||
var pvers = package.version.split('.')
|
||||
package.version = `${pvers[0]}.${pvers[1]}.${pvers[2]}-${channel}.${process.env['CIRCLE_BUILD_NUM']}`
|
||||
const version = pkg.version.split('.');
|
||||
pkg.version = `${version[0]}.${version[1]}.${version[2]}-${channel}.${process.env['CIRCLE_BUILD_NUM']}`
|
||||
// package.build.channel = channel
|
||||
package.publish = {
|
||||
"provider": "github",
|
||||
"repo": "cider-releases",
|
||||
"owner": "ciderapp",
|
||||
"vPrefixedTagName": true,
|
||||
"tag": `v${package.version}`,
|
||||
"channel": channel,
|
||||
"releaseType": "release"
|
||||
pkg.publish = {
|
||||
"provider": "github",
|
||||
"repo": "cider-releases",
|
||||
"owner": "ciderapp",
|
||||
"vPrefixedTagName": true,
|
||||
"tag": `v${pkg.version}`,
|
||||
"channel": channel,
|
||||
"releaseType": "release"
|
||||
}
|
||||
|
||||
let {exec} = require('child_process')
|
||||
exec('echo $APP_VERSION', {env: {'APP_VERSION': package.version}}, function (error, stdout, stderr)
|
||||
{
|
||||
console.log(stdout, stderr, error);
|
||||
exec('echo $APP_VERSION', {env: {'APP_VERSION': pkg.version}}, function (error, stdout, stderr) {
|
||||
console.log(stdout, stderr, error);
|
||||
});
|
||||
fs.writeFile('package.json', JSON.stringify(package), err => {
|
||||
// error checking
|
||||
if(err) throw err;
|
||||
console.log(`VERSION CHANGED TO ${package.version}`);
|
||||
fs.writeFile('package.json', JSON.stringify(pkg), err => {
|
||||
// error checking
|
||||
if (err) throw err;
|
||||
console.log(`VERSION CHANGED TO ${pkg.version}`);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue