From 08d2dad949423ceacb2bb90fa6cbbe0320a19a4e Mon Sep 17 00:00:00 2001 From: arvinxx Date: Tue, 19 Jan 2021 04:52:00 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20fix(config):=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 24 ++++++++++++++++++++---- .releaserc.js | 12 +++++++++++- package.json | 3 ++- scripts/zip.ts | 5 +++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 357c13d..f6e0328 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,24 @@ name: Release CI on: [push] jobs: release: - runs-on: macos-latest - + name: Release + runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@master + - uses: actions/checkout@v2 + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.2 + with: + node-version: '14' + + - name: Cache multiple paths + uses: actions/cache@v2 + with: + path: | + ~/.npm + ~/cache + !~/cache/exclude + **/node_modules + key: npm-${{ runner.os }}-${{ hashFiles('package.json') }} - name: install run: yarn @@ -14,6 +27,9 @@ jobs: - name: lint run: yarn lint && yarn tsc + - name: build + run: yarn zip + - name: release run: yarn release env: diff --git a/.releaserc.js b/.releaserc.js index 386c541..86566b0 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -23,7 +23,17 @@ module.exports = { }, ], '@semantic-release/npm', //如果是npm包会自动更新版本号并发布 - '@semantic-release/github', // 推送代码回到GitHub + [ + '@semantic-release/github', + { + assets: [ + { + path: 'dist-zip/power-yuque.zip', + label: 'power-yuque.${nextRelease.gitTag}.zip', + }, + ], + }, + ], // 推送代码回到GitHub [ '@semantic-release/git', //发布release { diff --git a/package.json b/package.json index 510df33..7049483 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "scripts": { "start": "umi dev", "build": "umi build", - "zip": "ts-node ./scripts/zip", + "zip": "yarn build && yarn zip:only", + "zip:only": "ts-node ./scripts/zip", "--------- ": "", "test": "umi-test", "test:update": "UPDATE=1 umi-test --update-snapshot", diff --git a/scripts/zip.ts b/scripts/zip.ts index 54cd9af..f7a3116 100755 --- a/scripts/zip.ts +++ b/scripts/zip.ts @@ -42,10 +42,15 @@ const buildZip = (src: string, dist: string, zipFilename: string) => { const main = () => { const { name, version } = extractExtensionData(); const zipFilename = `${name}-v${version}.zip`; + const zipDistName = `${name}.zip`; makeDestZipDirIfNotExists(); buildZip(DEST_DIR, DEST_ZIP_DIR, zipFilename) + .then(() => console.info('✅ Build Done with Version!')) + .catch(console.error); + + buildZip(DEST_DIR, DEST_ZIP_DIR, zipDistName) .then(() => console.info('✅ Build Done!')) .catch(console.error); };