Skip to content

Commit

Permalink
feat: update publish steps
Browse files Browse the repository at this point in the history
  • Loading branch information
2F-112 committed Jul 10, 2023
1 parent d434bbd commit 30b379f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
run: |
npm ci
npm run build
cd dist && zip -r subtitle_easy.zip . && cd ..
- name: Upload & release
uses: mnao305/[email protected]
with:
Expand Down
34 changes: 12 additions & 22 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ZipWebpackPlugin = require('zip-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');

const rimraf = require('rimraf');

module.exports = {
mode: 'production',
entry: {
// No entry point needed if you only want to copy files
},
plugins: [
new CopyWebpackPlugin({
// copy subtitle.dual folder to dist except manifest.json
patterns: [
{
from: path.resolve(__dirname, 'subtitle.dual'),
to: path.resolve(__dirname, 'dist'),
globOptions: {
ignore: ['**/manifest.json']
}
}
]
}),
new WebpackManifestPlugin({
fileName: 'manifest.json',
seed: require('./subtitle.dual/manifest.json'),
generate: (seed, files) => {
generate: (seed) => {
const manifest = seed || {};

// set version to current git commit tag and rm the prefix 'v'
Expand All @@ -42,13 +27,18 @@ module.exports = {
return manifest;
}
}),
new ZipWebpackPlugin({
path: path.resolve(__dirname, 'dist'),
filename: 'subtitle_easy.zip'
new CopyWebpackPlugin({
// copy subtitle.dual folder to dist except manifest.json
patterns: [
{
from: path.resolve(__dirname, 'subtitle.dual'),
to: path.resolve(__dirname, 'dist'),
globOptions: {
ignore: ['**/manifest.json']
}
}
]
})
],
devtool: 'source-map'
};

// 清除 dist 文件夹
rimraf.sync(path.resolve(__dirname, 'dist'));

0 comments on commit 30b379f

Please sign in to comment.