Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Improve CI/Docker build/release #6938

Merged
merged 2 commits into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-develop

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