Skip to content

Commit 49b79c8

Browse files
committed
Added publishing script
1 parent 7ebe516 commit 49b79c8

File tree

6 files changed

+177
-15
lines changed

6 files changed

+177
-15
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
.DS_Store
22
Quirkbot-Windows-Drivers-Installer.zip
33
Quirkbot-Windows-Drivers-Only.zip
4+
quirkbot-windows-drivers-*
5+
quirkbot-windows-drivers
46
s3_publish
7+
aws-config
8+
node_modules
9+
npm-debug.log

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
node_modules
3+
npm-debug.log
4+
quirkbot-chrome-app
5+
quirkbot-chrome-app.zip
6+
quirkbot-chrome-app-*
7+
s3_publish
8+
aws-config

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,65 @@
11
# Quirkbot Windows Drivers Installer
22

3-
### Build instructions (Windows)
3+
## Build instructions (Windows)
44

5-
- Downdload and install [NSIS](http://nsis.sourceforge.net/Download) (testd with ```3.0b1```).
5+
- Downdload and install [NSIS](http://nsis.sourceforge.net/Download) (verison ```3.0b3```).
66
- Right click ```build.nsi``` and select ```Compile Script``.
77
- Wait for ```Quirkbot-Windows-Drivers-Installer.exe``` to be generated.
8+
9+
10+
## Building releases
11+
12+
You should build and test the release before deploying them:
13+
14+
- Install node dependencies:
15+
```
16+
npm install
17+
```
18+
- Update the version in `package.json`
19+
- Run:
20+
```
21+
npm run gulp -- build
22+
```
23+
24+
## Deploying Releases
25+
To deploy to Amazon S3, please create the corresponding configuration
26+
files in `/aws-config/[environment].json`.
27+
For security, those files should not be included on the repository.
28+
29+
Examples:
30+
31+
#### `/aws-config/stage.json`
32+
33+
```
34+
{
35+
"key": "YOUR_S3_KEY",
36+
"secret": "YOUR_S3_SECRET",
37+
"bucket": "code-stage.quirkbot.com",
38+
"region": "us-east-1"
39+
}
40+
41+
```
42+
#### `/aws-config/production.json`
43+
44+
```
45+
{
46+
"key": "YOUR_S3_KEY",
47+
"secret": "YOUR_S3_SECRET",
48+
"bucket": "code.quirkbot.com",
49+
"region": "us-east-1"
50+
}
51+
52+
```
53+
54+
Before deploying, please run the "Building Releases" instructions and make sure
55+
everything works as desired. When you are ready to deploy:
56+
57+
- Update the version in `package.json`
58+
- Run:
59+
```
60+
npm run gulp -- deploy --environment=stage
61+
```
62+
or
63+
```
64+
npm run gulp -- deploy --environment=production
65+
```

gulpfile.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
var fs = require('fs');
5+
var gulp = require('gulp');
6+
var argv = require('yargs').default('environment', 'stage').argv;
7+
var $ = require('gulp-load-plugins')();
8+
var merge = require('merge-stream');
9+
var runSequence = require('run-sequence');
10+
11+
var SRC_NAME = 'Quirkbot-Windows-Drivers-Installer.exe';
12+
var RELEASE_NAME = 'quirkbot-windows-drivers';
13+
var PACKAGE = JSON.parse(fs.readFileSync('package.json'));
14+
var VERSION_FILENAME = `${RELEASE_NAME}-${PACKAGE.version}.exe`;
15+
var LATEST_FILENAME = `${RELEASE_NAME}-latest.exe`;
16+
17+
18+
/**
19+
* Cleans all the generated files
20+
*/
21+
gulp.task('clean', function () {
22+
return gulp.src([
23+
LATEST_FILENAME,
24+
RELEASE_NAME + '-*.exe'
25+
])
26+
.pipe($.clean());
27+
});
28+
29+
30+
/**
31+
* Generate the files that will be published
32+
*/
33+
gulp.task('build', function (cb) {
34+
35+
var exec = require('child_process').exec;
36+
37+
exec(
38+
`cp ${SRC_NAME} ${LATEST_FILENAME} `+
39+
`&& cp ${SRC_NAME} ${VERSION_FILENAME}`,
40+
(error, stdout, stderr) => {
41+
console.log(stderr)
42+
cb();
43+
}
44+
);
45+
46+
});
47+
48+
/**
49+
* Builds and publish to s3
50+
*/
51+
gulp.task('s3', ['build'], function () {
52+
var aws = JSON.parse(fs.readFileSync(path.join('aws-config', `${argv.environment}.json`)));
53+
54+
return gulp.src([
55+
LATEST_FILENAME,
56+
VERSION_FILENAME
57+
])
58+
.pipe($.s3(aws, {
59+
uploadPath: 'downloads/'
60+
}));
61+
});
62+
63+
64+
/**
65+
* Deploys the release. Asks for confirmation if deploying to production
66+
*/
67+
gulp.task('confirm-deploy', [], function () {
68+
if(argv.environment == 'production'){
69+
return gulp.src('')
70+
.pipe($.prompt.confirm('You are about to deploy TO PRODUCTION! Are you sure you want to continue)'))
71+
.pipe($.prompt.confirm('Really sure?!'))
72+
}
73+
74+
});
75+
gulp.task('deploy', function (cb) {
76+
runSequence(
77+
'confirm-deploy',
78+
's3',
79+
cb);
80+
});
81+
82+

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "quirkbot-windows-drivers-installer",
3+
"version" : "2.0.0",
4+
"description" : "Windows drivers installers",
5+
"author" : "Paulo Barcelos <[email protected]>",
6+
"homepage" : "https://github.com/Quirkbot/QuirkbotWindowsDriversInstaller",
7+
"license" : "SEE LICENSE IN LICENSE.txt",
8+
"devDependencies": {
9+
"gulp": "^3.9.1",
10+
"gulp-clean": "^0.3.2",
11+
"gulp-load-plugins": "^1.2.0",
12+
"gulp-prompt": "^0.1.2",
13+
"gulp-s3": "^0.3.0",
14+
"merge-stream": "^1.0.0",
15+
"run-sequence": "^1.1.5",
16+
"yargs": "^4.2.0"
17+
},
18+
"scripts": {
19+
"gulp": "node ./node_modules/gulp/bin/gulp.js",
20+
"gulp:xunit": "npm run gulp -- --reporter xunit"
21+
}
22+
}

s3-publish.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)