构建工作流

This commit is contained in:
j m 2024-05-11 09:53:14 +08:00
parent 18ef724dc7
commit 4d3e6f8166
3 changed files with 9 additions and 4 deletions

View File

@ -6,8 +6,7 @@ name: Node.js CI
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master" ]
paths: ["version"]
jobs:
build:
@ -21,6 +20,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: version
id: version
run: |
version=$(cat version |sed -ne "s/VERSION\s=\s'v\(.*\)'/\1/gp")
echo "version=$version" >> $GITHUB_ENV
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
@ -30,7 +34,7 @@ jobs:
run: npm install
# Actions构建
- name: Build
run: npm run actions
run: npm run actions --tag=${{ env.version }}
# 上传构建产物zip
- name: Upload artifacts
uses: actions/upload-artifact@v4

View File

@ -149,7 +149,7 @@ task('default', series('clean', parallel('css', 'js'), 'zip'))
task('release', series('clean', 'version', parallel('css', 'js'), 'zip'))
// GitHub - Actions模式
task('actions', series('clean', parallel('css', 'js'), 'actions-build'))
task('actions', series('clean', 'version', parallel('css', 'js'), 'actions-build'))
// push模式需要使用--tag参数指定版本号
task('push', series('clean', 'version', parallel('css', 'js'), 'zip', 'publish'))

1
version Normal file
View File

@ -0,0 +1 @@
VERSION='v1.2.1'