Browse Source

Revert "使用GitHub Action自动打包crx扩展,并利用GitHub进行自动更新"

Alien-阿烈叔 5 years ago
parent
commit
5e53ca3404
3 changed files with 3 additions and 58 deletions
  1. 0 32
      .github/workflows/build.yml
  2. 2 24
      gulpfile.js
  3. 1 2
      package.json

+ 0 - 32
.github/workflows/build.yml

@@ -1,32 +0,0 @@
-name: buildCrx
-on:
-  watch:
-    types: [started]
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-        with:
-          ref: stable #只打包stable分支
-      - name: Use Node.js
-        uses: actions/setup-node@v1
-        with:
-          node-version: '11.x'
-      - name: build
-        env:
-          PRIVATE_KEY: ${{ secrets.buildPem }}
-        run: |
-          npm install
-          npm install crx3
-          cat <<< $PRIVATE_KEY > ../build.pem
-          npm run crx
-      - name: Set git identity
-        run : |
-          git config --global user.email "[email protected]"
-          git config --global user.name "tofuliang"
-          rm -fr node_modules output package-lock.json
-          git add chrome/fehelper.crx chrome/update.xml
-          git checkout *
-          git commit -m "update crx"
-          git push

+ 2 - 24
gulpfile.js

@@ -22,7 +22,7 @@ let watchPath = require('gulp-watch-path');
 let gcallback = require('gulp-callback');
 
 gulp.task('clean', () => {
-    return gulp.src(['output','chrome'], {read: false}).pipe(clean({force: true}));
+    return gulp.src('output', {read: false}).pipe(clean({force: true}));
 });
 
 gulp.task('copy', () => {
@@ -155,24 +155,6 @@ gulp.task('zip', () => {
 
 });
 
-// 打包成crx
-gulp.task('_crx',() => {
-    let pathOfMF = './output/apps/manifest.json';
-    let manifest = require(pathOfMF);
-    shell.exec('[ ! -d chrome ] && mkdir chrome');
-    shell.exec('cat output/fehelper.zip | npx crx3 -p ../build.pem -o chrome/fehelper.crx -x chrome/update.xml --appVersion '+manifest.version+' --crxURL https://raw.githubusercontent.com/'+manifest.author+'/FeHelper/master/fehelper.crx');
-
-    let size = fs.statSync('chrome/fehelper.crx').size;
-    size = pretty(size);
-
-    console.log('\n\nfehelper.crx 已打包完成!');
-    console.log('\n\n================================================================================');
-    console.log('    当前版本:', manifest.version, '\t文件大小:', size);
-    console.log('    提交到GitHub享受摆脱Chrome Webstore的自动更新吧');
-    console.log('================================================================================\n\n');
-
-});
-
 // 打包Firefox安装包
 gulp.task('firefox', () => {
     shell.exec('rm -rf output-firefox && cp -r output output-firefox && rm -rf output-firefox/fehelper.zip');
@@ -220,10 +202,6 @@ gulp.task('default', ['clean'], () => {
     runSequence(['copy', 'css', 'js', 'html', 'json'], 'zip');
 });
 
-gulp.task('crx', ['clean'], () => {
-    runSequence(['copy', 'css', 'js', 'html', 'json'],'zip','_crx');
-});
-
 gulp.task('sync', () => {
     gulp.src('apps/**/*').pipe(gulp.dest('output/apps'));
 });
@@ -236,4 +214,4 @@ gulp.task('watch', () => {
             console.log(new Date().toLocaleString(), '> 文件发生变化,已编译:', wp.srcPath);
         }));
     });
-});
+});

+ 1 - 2
package.json

@@ -23,8 +23,7 @@
   },
   "scripts": {
     "watch": "gulp watch",
-    "build": "gulp",
-    "crx": "gulp crx"
+    "build": "gulp"
   },
   "repository": {
     "type": "git",