Skip to content

Commit

Permalink
Merge pull request #6938 from RocketChat/test-ci
Browse files Browse the repository at this point in the history
[NEW] Improve CI/Docker build/release
  • Loading branch information
rodrigok committed May 10, 2017
1 parent d2d829f commit 2fa89b1
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .docker/latest/Dockerfile → .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rocketchat/base:4

ENV RC_VERSION latest
ENV RC_VERSION 0.56.0-rc.2

MAINTAINER buildmaster@rocket.chat

Expand Down
38 changes: 0 additions & 38 deletions .docker/develop/Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions .docker/release-candidate/Dockerfile

This file was deleted.

48 changes: 48 additions & 0 deletions .scripts/set-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* eslint object-shorthand: 0, prefer-template: 0 */

const path = require('path');
const fs = require('fs');
let pkgJson = {};

try {
pkgJson = require(path.resolve(
process.cwd(),
'./package.json'
));
} catch (err) {
console.error('no root package.json found');
}

const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

const files = [
'./package.json',
'./.sandstorm/sandstorm-pkgdef.capnp',
'./.travis/snap.sh',
'./.docker/Dockerfile.sh',
'./packages/rocketchat-lib/rocketchat.info'
];

console.log('Current version:', pkgJson.version);
rl.question('New version: ', function(version) {
rl.close();

version = version.trim();

if (version === '') {
return;
}

console.log('Updating files to version ' + version);

files.forEach(function(file) {
const data = fs.readFileSync(file, 'utf8');

fs.writeFileSync(file, data.replace(pkgJson.version, version), 'utf8');
});
});
36 changes: 2 additions & 34 deletions .scripts/version.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint object-shorthand: 0, prefer-template: 0 */

const path = require('path');
const fs = require('fs');
let pkgJson = {};
var pkgJson = {};

try {
pkgJson = require(path.resolve(
Expand All @@ -13,35 +12,4 @@ try {
console.error('no root package.json found');
}

const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

const files = [
'./package.json',
'./.sandstorm/sandstorm-pkgdef.capnp',
'./.travis/snap.sh',
'./packages/rocketchat-lib/rocketchat.info'
];

console.log('Current version:', pkgJson.version);
rl.question('New version: ', function(version) {
rl.close();

version = version.trim();

if (version === '') {
return;
}

console.log('Updating files to version ' + version);

files.forEach(function(file) {
const data = fs.readFileSync(file, 'utf8');

fs.writeFileSync(file, data.replace(pkgJson.version, version), 'utf8');
});
});
console.log(pkgJson.version);
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ services:
branches:
only:
- develop
- release-candidate
- "/^\\d+\\.\\d+\\.\\d+(-rc\\.\\d+)?$/"
git:
depth: 1
Expand Down
7 changes: 1 addition & 6 deletions .travis/setartname.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
if [[ $TRAVIS_TAG ]]
then
export ARTIFACT_NAME="$TRAVIS_TAG";
else
export ARTIFACT_NAME="$TRAVIS_BRANCH";
fi
export ARTIFACT_NAME="$(meteor npm run version --silent)"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"chimp-test": "chimp tests/chimp-config.js",
"postinstall": "cd packages/rocketchat-katex && npm i",
"version": "node .scripts/version.js",
"release": "npm run version && conventional-changelog --config .github/changelog.js -i HISTORY.md -s"
"set-version": "node .scripts/set-version.js",
"release": "npm run set-version && conventional-changelog --config .github/changelog.js -i HISTORY.md -s"
},
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 2fa89b1

Please sign in to comment.