test workflow #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Version | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| jobs: | |
| update-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # 确保可以获取完整的分支信息 | |
| - name: Switch to main branch | |
| run: | | |
| git checkout main # 将 "main" 替换为你的默认分支名 | |
| - name: Update _version.py | |
| run: | | |
| TAG_NAME=$(echo ${{ github.ref_name }}) | |
| echo "__version__ = '${TAG_NAME:1}'" > pyfmm/_version.py | |
| - name: Commit changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add pyfmm/_version.py | |
| git commit -m "Update version to ${{ github.ref_name }}" | |
| git push origin main # 推送到 "main" 分支 | |