update-version.yml 754 B

1234567891011121314151617181920212223242526272829303132
  1. name: Update Version
  2. on:
  3. push:
  4. branches:
  5. - master # 监听主分支代码提交事件
  6. jobs:
  7. update-version:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v2
  12. - name: Update version
  13. run: |
  14. # 读取当前版本号
  15. current_version=$(cat VERSION)
  16. # 将版本号加1
  17. new_version=$((current_version + 1))
  18. # 更新版本号到文件
  19. echo $new_version > VERSION
  20. - name: Commit changes
  21. run: |
  22. git config --local user.email "action@github.com"
  23. git config --local user.name "GitHub Action"
  24. git commit -m "Update version" -a
  25. git push origin master