Browse Source

增加版本号维护

冷冷 1 year ago
parent
commit
80f5d6e575
2 changed files with 33 additions and 0 deletions
  1. 32 0
      .github/workflows/update-version.yml
  2. 1 0
      VERSION

+ 32 - 0
.github/workflows/update-version.yml

@@ -0,0 +1,32 @@
+name: Update Version
+
+on:
+  push:
+    branches:
+      - master # 监听主分支代码提交事件
+
+jobs:
+  update-version:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Update version
+        run: |
+          # 读取当前版本号
+          current_version=$(cat VERSION)
+          
+          # 将版本号加1
+          new_version=$((current_version + 1))
+          
+          # 更新版本号到文件
+          echo $new_version > VERSION
+
+      - name: Commit changes
+        run: |
+          git config --local user.email "action@github.com"
+          git config --local user.name "GitHub Action"
+          git commit -m "Update version" -a
+          git push origin master

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+1