Skip to content

Commit

Permalink
feat:actions
Browse files Browse the repository at this point in the history
  • Loading branch information
iRuxu committed Nov 4, 2023
1 parent a8d7b84 commit 116bb71
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 78 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Preview Master
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v16.18.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install && Build
run: |
npm install
npm run build
- name: Github Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
CLEAN: true

## TODO:下方修改两处
- name: OSS
uses: manyuanrong/[email protected]
with:
endpoint: "oss-cn-hangzhou.aliyuncs.com"
access-key-id: ${{secrets.AccessKey_ID}}
access-key-secret: ${{secrets.Access_Key_Secret}}
- run: ossutil cp -rf dist oss://jx3box/static/macro
#- run: ossutil cp -rf dist oss://jx3box-www/macro

63 changes: 27 additions & 36 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
name: Github Pages
name: Preview Master
on:
push:
branches:
- master
push:
tags:
- "v*.*.*"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v16.18.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v16.18.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install && Build
run: |
npm install
npm run build
- name: Github Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
CLEAN: true
# CLEAN_EXCLUDE: '["css", "js"]'

- name: OSS
uses: manyuanrong/[email protected]
with:
endpoint: "oss-cn-hangzhou.aliyuncs.com"
access-key-id: ${{secrets.AccessKey_ID}}
access-key-secret: ${{secrets.Access_Key_Secret}}
- run: ossutil cp -rf dist oss://jx3box/static/macro
## TODO:下方修改一处
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_NANJING2 }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
cd /www/wwwroot/jx3box/jx3box-v2
cd macro
git checkout gh-pages
git pull origin gh-pages
33 changes: 33 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Preview Dev
on:
push:
branches:
- dev
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v16.18.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install && Build
run: |
npm install
npm run preview
## TODO:下方修改1处
- name: GrayEnv
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST_NANJING2 }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
source: macro/*
target: /www/wwwroot/jx3box/test

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
"dev": "cross-env DEV_SERVER=true vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"preview": "cross-env BUILD_MODE=preview vue-cli-service build",
"lint": "vue-cli-service lint",
"inspect": "vue inspect > output.js",
"update": "npm --registry https://registry.npmjs.org install @jx3box/jx3box-common-ui@latest @jx3box/jx3box-common@latest @jx3box/jx3box-data@latest @jx3box/jx3box-macro@latest @jx3box/jx3box-talent@latest @jx3box/jx3box-talent2@latest @jx3box/jx3box-dict@latest @jx3box/jx3box-comment-ui@latest @jx3box/jx3box-editor@latest"
},
"dependencies": {
"@jx3box/jx3box-comment-ui": "^1.7.16",
"@jx3box/jx3box-common": "^8.0.2",
"@jx3box/jx3box-common-ui": "^7.8.8",
"@jx3box/jx3box-data": "^3.5.3",
"@jx3box/jx3box-common": "^8.0.3",
"@jx3box/jx3box-common-ui": "^7.9.2",
"@jx3box/jx3box-data": "^3.5.4",
"@jx3box/jx3box-dict": "^2.2.0",
"@jx3box/jx3box-editor": "^1.9.9",
"@jx3box/jx3box-editor": "^2.0.0",
"@jx3box/jx3box-macro": "^1.0.1",
"@jx3box/jx3box-talent": "^1.2.7",
"@jx3box/jx3box-talent2": "^1.5.7",
Expand Down
1 change: 1 addition & 0 deletions src/assets/css/list.less
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
.db;
.mt(3px);
.clear;
i{.mr(5px);}
}

.u-down {
Expand Down
40 changes: 2 additions & 38 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,49 +71,13 @@ module.exports = {
},
},

//webpack配置
// configureWebpack: (config) => {
// // 开启分离js
// config.optimization = {
// runtimeChunk: "single",
// splitChunks: {
// chunks: "all",
// maxInitialRequests: Infinity,
// minSize: 200000,
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name(module) {
// // get the name. E.g. node_modules/packageName/not/this/part.js
// // or node_modules/packageName
// const packageName = module.context.match(
// /[\\/]node_modules[\\/](.*?)([\\/]|$)/
// )[1];
// // npm package names are URL-safe, but some servers don't like @ symbols
// return `npm.${packageName.replace("@", "")}`;
// },
// },
// },
// },
// };
// // 取消webpack警告的性能提示
// config.performance = {
// hints: "warning",
// //入口起点的最大体积
// maxEntrypointSize: 50000000,
// //生成文件的最大体积
// maxAssetSize: 30000000,
// //只给出 js 文件的性能提示
// assetFilter: function(assetFilename) {
// return assetFilename.endsWith(".js");
// },
// };
// },
outputDir: process.env["BUILD_MODE"] == "preview" ? path.resolve(__dirname, pkg.name) : 'dist', // 指定构建输出的目录

//❤️ define path for static files ~
publicPath:
//FOR Localhost => development
(process.env.NODE_ENV === "development" && "/") ||
process.env.BUILD_MODE == "preview" && `/${pkg.name}/` ||
//BY origin
(process.env.STATIC_PATH === "origin" && `${JX3BOX.__staticPath["origin"]}${pkg.name}/`) ||
//BY github
Expand Down

0 comments on commit 116bb71

Please sign in to comment.