Skip to content

Commit c913056

Browse files
committed
Improved version management
Signed-off-by: Gary Kim <[email protected]>
1 parent d2a17a3 commit c913056

File tree

10 files changed

+62
-10
lines changed

10 files changed

+62
-10
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ For a new file, add this license header to the top of the file:
8585
*/
8686
```
8787

88+
### Make a new release
89+
90+
1. Ensure that all CI tests pass on the latest commit.
91+
2. Update the version number with `npm version [major|minor|patch] --no-git` and update the version name manually in [package.json](package.json).
92+
3. Run `npm ci` to install all dependencies for building from [package-lock.json](package-lock.json).
93+
4. Update [CHANGELOG.md](CHANGELOG.md) with the update changelog for the new version.
94+
5. Make a new git commit and tag with `git commit -S`, `git tag VERSION -a`, add the new version name as the annotation, then run `git push origin VERSION`.
95+
6. Run `npm run clean`, `npm run webpack:build:firefox`, then `npm run package`. Upload the resulting package to [AMO](https://addons.mozilla.org/en-US/developers/addons) to have the extension signed. Upload the result into GitHub releases then update the update server to point to the new release.
96+
7. Run `npm run clean`, `npm run webpack:build:chromium`, then `npm run package`. Upload the resulting package to [CWS](https://chrome.google.com/webstore/developer/dashboard) to have the new version signed and released.
97+
8898
### Developer Certificate of Origin
8999
```
90100
Developer Certificate of Origin

nightwatch.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
const fs = require('fs');
2626
const JSZip = require('jszip');
27-
const manifest = require('./src/manifest.json');
27+
const manifest = require('./dist/manifest.json');
2828

2929
module.exports = {
3030
src_folders: ['tests'],
@@ -64,6 +64,9 @@ module.exports = {
6464
};
6565

6666
function generateFirefoxProfile() {
67+
if (!manifest.applications){
68+
return;
69+
}
6770
const zip = new JSZip();
6871
zip.file(`extensions/${manifest.applications.gecko.id}.xpi`, fs.readFileSync(`artifacts/sas_powerschool_enhancement_suite-${manifest.version}.zip`));
6972
zip.file('prefs.js', 'user_pref("xpinstall.signatures.required", false);');

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "saspes",
33
"version": "1.7.2",
4+
"version_name": "Open Beta 0.1.7.2",
5+
"private": true,
46
"description": "SAS Powerschool Enhancement Suite",
57
"main": "index.js",
68
"scripts": {

src/manifest - chromium.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"manifest_version": 2,
33
"name": "SAS Powerschool Enhancement Suite",
44
"short_name": "SAS PES",
5-
"version": "0.1.7.2",
6-
"version_name": "Public Beta 0.1.7.2",
5+
"version": "SET_DURING_BUILD",
6+
"version_name": "SET_DURING_BUILD",
77
"author": "Gary Kim",
88
"homepage_url": "https://github.com/gary-kim/saspes/",
99
"description": "Provides various enhancements for SAS Powerschool",

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "SAS Powerschool Enhancement Suite",
44
"short_name": "SAS PES",
5-
"version": "0.1.7.2",
5+
"version": "SET_DURING_BUILD",
66
"author": "Gary Kim",
77
"homepage_url":"https://github.com/gary-kim/saspes/",
88
"description": "Provides various enhancements for SAS Powerschool",

tests/extensionInfo.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@
2222
*
2323
*/
2424

25+
const package = require('../package.json');
2526

2627
module.exports = {
2728
"Show Extension Info": browser => {
2829
browser
2930
.url("https://powerschool.sas.edu.sg")
3031
.waitForElementVisible("#saspes-info")
31-
.end();
32+
},
33+
"Extension Version Correct": browser => {
34+
browser
35+
.assert.containsText('#saspes-info', 'SAS Powerschool Enhancement Suite')
36+
.assert.containsText("#saspes-info", `Version: ${package.version}`)
37+
.end()
3238
}
33-
}
39+
}

webpack.chromium.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
const merge = require('webpack-merge');
22
const common = require('./webpack.common.js');
3+
const helpers = require('./webpack.helpers.js');
34
const CopyPlugin = require('copy-webpack-plugin');
5+
const package = require('./package.json');
46
const path = require('path');
57

68
module.exports = merge(common, {
79
mode: 'production',
810
plugins: [
911
new CopyPlugin([
10-
{ from: path.join(__dirname, 'src', 'manifest - chromium.json'), to: 'manifest.json'}
12+
{
13+
from: path.join(__dirname, 'src', 'manifest - chromium.json'),
14+
to: 'manifest.json',
15+
transform(content) {
16+
return helpers.setManifestVersion(content, package.version, package.version_name)
17+
}
18+
}
1119
])
1220
]
1321
});

webpack.common.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const path = require('path');
22
const CopyPlugin = require('copy-webpack-plugin');
3-
const { VueLoaderPlugin } = require('vue-loader')
3+
const { VueLoaderPlugin } = require('vue-loader');
4+
const webpack = require('webpack');
5+
const package = require('./package.json');
46

57
module.exports = {
68
entry: {
@@ -38,7 +40,10 @@ module.exports = {
3840
new CopyPlugin([
3941
{ from: "src", to: '', ignore: ['*.js', 'js/**', 'manifest.json', 'manifest - chromium.json', '.eslintrc.json']}
4042
]),
41-
new VueLoaderPlugin()
43+
new VueLoaderPlugin(),
44+
new webpack.DefinePlugin({
45+
"EXTENSION_VERSION_NAME": JSON.stringify(package.version_name)
46+
})
4247
],
4348
resolve: {
4449
extensions: ['.js', '.vue']

webpack.firefox.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
const merge = require('webpack-merge');
22
const common = require('./webpack.common.js');
3+
const helpers = require('./webpack.helpers.js');
34
const CopyPlugin = require('copy-webpack-plugin');
5+
const package = require('./package.json');
46
const path = require('path');
57

68
module.exports = merge(common, {
79
mode: 'production',
810
plugins: [
911
new CopyPlugin([
10-
{ from: path.join(__dirname, 'src', 'manifest.json'), to: 'manifest.json'}
12+
{
13+
from: path.join(__dirname, 'src', 'manifest.json'),
14+
to: 'manifest.json',
15+
transform(content) {
16+
return helpers.setManifestVersion(content, package.version)
17+
}
18+
}
1119
])
1220
]
1321
});

webpack.helpers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
setManifestVersion: function(contents, version, version_name) {
3+
let manifest = JSON.parse(contents);
4+
manifest.version = version;
5+
if (typeof version_name !== 'undefined') {
6+
manifest.version_name = version_name;
7+
}
8+
return JSON.stringify(manifest);
9+
}
10+
}

0 commit comments

Comments
 (0)