Skip to content

Commit

Permalink
chore(actions): release flow on push
Browse files Browse the repository at this point in the history
  • Loading branch information
bartholomej committed Dec 8, 2019
1 parent 1f348d1 commit 832179a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 14 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release Chrome Web Store

on:
push:
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@master

- name: Use Node.js 13.x
uses: actions/setup-node@master
with:
node-version: 13.x

# - name: Get the version tag
# id: get_version
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Build extension for Chrome
run: |
npm install
npm run build:chrome
- name: Deploy to Chrome Web Store
uses: trmcnvn/chrome-addon@v1
with:
extension: kkoccljoocknljaljhpifcnkmillmilo
zip: zip/chrome.zip
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
env:
CI: true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13
37 changes: 23 additions & 14 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,34 @@ const commonConfig = require('./webpack.common.js');
const browserConfig = require('./browsers.manifest.json');
const version = process.env.npm_package_version;

module.exports = function (options) {
module.exports = options => {
var target = options.target;
if (target) {
var browserSpecificProperties = browserConfig[target];
}
return webpackMerge(commonConfig(), {
mode: 'production',
optimization: {
minimize: false
minimize: false,
},
plugins: [
new webpack.DefinePlugin({
'BROWSER': JSON.stringify(target)
BROWSER: JSON.stringify(target),
}),
new CopyWebpackPlugin([
{
from: 'src/manifest-common.json',
to: 'manifest.json',
transform: function (content, path) {
transform: (content, path) => {
var manifest = JSON.parse(content.toString());
manifest.version = version;
var manifestObj = Object.assign(manifest, browserSpecificProperties);
var manifestObj = Object.assign(
manifest,
browserSpecificProperties
);
return JSON.stringify(manifestObj, null, 2);
}
}
},
},
]),
new ZipPlugin({
// OPTIONAL: defaults to the Webpack output path (above)
Expand All @@ -40,7 +43,7 @@ module.exports = function (options) {

// OPTIONAL: defaults to the Webpack output filename (above) or,
// if not present, the basename of the path
filename: target + '-v' + version + '.zip',
filename: target + '.zip',

// OPTIONAL: defaults to 'zip'
// the file extension to use instead of 'zip'
Expand All @@ -52,7 +55,7 @@ module.exports = function (options) {

// OPTIONAL: defaults to the identity function
// a function mapping asset paths to new paths
pathMapper: function(assetPath) {
pathMapper: assetPath => {
// put all pngs in an `images` subdir
// if (assetPath.endsWith('.png'))
// return path.join(path.dirname(assetPath), 'images', path.basename(assetPath));
Expand Down Expand Up @@ -82,8 +85,14 @@ module.exports = function (options) {
zipOptions: {
forceZip64Format: false,
},
})
]
})
}

}),
// Create build zip with version
new CopyWebpackPlugin([
{
from: './zip/' + target + '.zip',
to: '../zip/' + target + '-v' + version + '.zip',
},
]),
],
});
};

0 comments on commit 832179a

Please sign in to comment.