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