diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e485397..149dee5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,13 @@ jobs: # Actions构建 - name: Build - run: npm run actions --tag=${{ env.version }} + if: ${{ env.branch_type != 'master' }} + run: npm run release --tag=${{ env.version }} + - name: Build + if: ${{ env.branch_type == 'master' }} + run: npm run push --tag=${{ env.version }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 如果是master分支,创建latest的Release,否则创建 预览版 - name: Create Release @@ -79,13 +85,3 @@ jobs: asset_path: ./dist/halo-theme-dream2.0-plus.zip asset_name: halo-theme-dream2.0-plus-V${{ env.version }}.zip asset_content_type: application/zip - - # 发布NPM包,master分支需要发布 - - name: npm ci - if: ${{ env.branch_type == 'master' }} - run: npm ci - - name: Publish to NPM - if: ${{ env.branch_type == 'master' }} - run: npm publish --access public --tag latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/gulpfile.js b/gulpfile.js index 6814536..06d60cc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,7 +14,6 @@ const resolve = (name) => path.resolve(__dirname, name) const cssPath = './templates/assets/css' const jsPath = './templates/assets/js' const distPath = './dist' -const distPathActions = './dist-actions' const devModel = process.env.npm_config_devel const version = process.env.npm_config_tag @@ -130,15 +129,6 @@ task('zip', () => { .pipe(dest(distPath)) }) -task('actions-build', () => { - const target = ['./templates/**', './*.yaml', 'README.md', 'LICENSE'] - src(target, {base: '.'}) - .pipe(zip('halo-theme-dream2.0-plus.zip')) - .pipe(dest(distPath)) - return src(target, {base: '.'}) - .pipe(dest(distPathActions)) -}) - task('publish', (done) => { // 需要将tag标签内容置为 latest process.env.npm_config_tag = 'latest' @@ -152,8 +142,5 @@ task('default', series('clean', parallel('css', 'js'), 'zip')) // release模式,需要使用--tag参数指定版本号 task('release', series('clean', 'version', parallel('css', 'js'), 'zip')) -// GitHub - Actions模式,需要使用--tag参数指定版本号 -task('actions', series('clean', 'version', parallel('css', 'js'), 'actions-build')) - // push模式,需要使用--tag参数指定版本号 task('push', series('clean', 'version', parallel('css', 'js'), 'zip', 'publish')) diff --git a/package.json b/package.json index 9f742f4..4a7ab59 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,12 @@ { "name": "halo-theme-dream2.0-plus", - "version": "1.2.1", + "version": "1.3.5", "description": "梦之城,童话梦境,动漫类型博客主题。", "main": "index.js", "author": "宏尘极客", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "release": "eslint src/**/*.js && gulp release", - "actions": "eslint src/**/*.js && gulp actions", "push": "eslint src/**/*.js && gulp push", "zip": "gulp zip", "build": "eslint src/**/*.js && gulp",