ver update #46
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: Tag | |
| on: | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| tag: | |
| name: Tag Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| fetch-depth: '0' | |
| - name: Bump version and push tag | |
| id: tag | |
| uses: anothrNick/github-tag-action@master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TAG_TOKEN }} | |
| WITH_V: true | |
| - name: Update package version | |
| if: steps.tag.outputs.new_tag | |
| run: | | |
| # Extract version without the 'v' prefix | |
| VERSION=${GITHUB_REF_NAME#v} | |
| # For a Python package | |
| sed -i "s/version=.*,/version='${VERSION}',/" setup.py | |
| # OR for projects using pyproject.toml | |
| # sed -i "s/version = .*/version = \"${VERSION}\"/" pyproject.toml | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add . | |
| git commit -m "chore: bump version to ${VERSION}" | |
| git push |