This commit is contained in:
mjsoftware 2024-12-27 16:15:10 +08:00
parent adc0af99b8
commit 15deb5b3d5
3 changed files with 8 additions and 26 deletions

View File

@ -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 }}

View File

@ -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'))

View File

@ -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",