Skip to content

Commit

Permalink
Automatic publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Aqours committed Jun 28, 2018
1 parent 2472b62 commit ad7ce9d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -2,7 +2,6 @@
.vscode

node_modules
deploy
dist

tests/key.js
npm-debug.log*
3 changes: 3 additions & 0 deletions .npmrc
@@ -1,2 +1,5 @@
# git tag prefix
tag-version-prefix=""

# disable package-lock.json
package-lock=false
22 changes: 22 additions & 0 deletions .travis.yml
@@ -0,0 +1,22 @@
# only tagged build/deploy
if: tag IS present

sudo: required
language: node_js
node_js:
- lts/*

env:
global:
- SOURCE=dist/bundle.zip
- EXTENSION_ID=pinjkilghdfhnkibhcangnpmcpdpmehk
- CLIENT_ID=$WS_CLIENT_ID
- CLIENT_SECRET=$WS_CLIENT_SECRET
- REFRESH_TOKEN=$WS_REFRESH_TOKEN

before_script:
- npm i
- npm run bundle

script:
- npx --no-install webstore upload --source $SOURCE --extension-id $EXTENSION_ID --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --refresh-token $REFRESH_TOKEN --auto-publish
21 changes: 14 additions & 7 deletions gulpfile.js
@@ -1,12 +1,19 @@
/**
* @file gulpfile
*/

const fs = require("fs");
const gulp = require("gulp");
const gulp_zip = require("gulp-zip");
const gulp_json_modify = require("gulp-json-modify");
const merge_stream = require("merge-stream");

gulp.task("bundle", function () {
const pkg = JSON.parse(fs.readFileSync("./package.json", {encoding: "utf8"}));
const others = gulp.src(["src/**", "!src/manifest.json"]);
const manifest = gulp.src("src/manifest.json")
.pipe(gulp_json_modify({
key: "version",
value: pkg.version,
}));

gulp.task("deploy", function () {
return gulp.src("source/**")
return merge_stream(manifest, others)
.pipe(gulp_zip("bundle.zip"))
.pipe(gulp.dest("deploy"))
.pipe(gulp.dest("dist"));
});
10 changes: 7 additions & 3 deletions package.json
@@ -1,10 +1,10 @@
{
"name": "weibo-picture-store",
"version": "1.0.0",
"version": "5.0.0",
"private": true,
"description": "Chrome Extension",
"scripts": {
"deploy": "gulp deploy"
"bundle": "rimraf dist && gulp bundle"
},
"repository": {
"type": "git",
Expand All @@ -17,7 +17,11 @@
},
"homepage": "https://github.com/Semibold/Weibo-Picture-Store#readme",
"devDependencies": {
"chrome-webstore-upload-cli": "1.1.1",
"gulp": "3.9.1",
"gulp-zip": "4.1.0"
"gulp-json-modify": "1.0.2",
"gulp-zip": "4.1.0",
"merge-stream": "1.0.1",
"rimraf": "2.6.2"
}
}

0 comments on commit ad7ce9d

Please sign in to comment.