added autoupdate version fix #4
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: Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Update version from tag | |
| run: | | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| python scripts/set_version.py $TAG_NAME | |
| git config user.name "github-actions" | |
| git config user.email "actions@github.com" | |
| git commit -am "chore: set version from $TAG_NAME" || echo "No changes to commit" | |
| git push origin HEAD:${GITHUB_REF_NAME} | |
| - name: Verify new version | |
| run: grep __version__ pytest_htmlx/__init__.py | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| user: __token__ | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| - name: Verify install from TestPyPI | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --index-url https://test.pypi.org/simple/ --no-deps mypackage | |
| # - name: Publish to PyPI | |
| # if: success() | |
| # uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # user: __token__ | |
| # password: ${{ secrets.PYPI_API_TOKEN }} |