From 4d3e6f8166f92ec628c894f0da9b8d5f13df708b Mon Sep 17 00:00:00 2001
From: j m <1406993111@qq.com>
Date: Sat, 11 May 2024 09:53:14 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .github/workflows/build.yml | 10 +++++++---
 gulpfile.js                 |  2 +-
 version                     |  1 +
 3 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 version

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 952c889..a6f41ba 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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
diff --git a/gulpfile.js b/gulpfile.js
index 47a9474..548591f 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -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'))
diff --git a/version b/version
new file mode 100644
index 0000000..8ed9eb7
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+VERSION='v1.2.1'
\ No newline at end of file