Fix release workflow #54
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: Release | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| env: | |
| DEFAULT_PYTHON: '3.13' | |
| jobs: | |
| release: | |
| name: Release package | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'dolfinus/setuptools-git-versioning' # prevent running on forks | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/onetl | |
| permissions: | |
| id-token: write # to auth in PyPI | |
| contents: write # to create Github release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.DEFAULT_PYTHON }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: "true" | |
| enable-cache: "false" | |
| - name: Fix version number | |
| # Fix for https://github.com/dolfinus/setuptools-git-versioning/issues/72#issuecomment-1312589464 | |
| run: | | |
| version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/") | |
| sed -i -E "s/dynamic = .*/version = \"${version}\"/" pyproject.toml | |
| - name: Build package | |
| run: uv build | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Create Github release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| dist/* |