Check for uv lock in sync before commit #40
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: cd | |
| description: This workflow releases a new version of the package before publishing it to PyPI. | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| if: "${{ github.event.pull_request.merged == true }}" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "0.7.7" # Match the version in the devcontainer stack - see https://github.com/windpioneers/gdal-python/releases | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Get package version | |
| id: version | |
| run: | | |
| VERSION=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) | |
| echo "package_version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own. | |
| with: | |
| tag_name: ${{ steps.version.outputs.package_version }} | |
| release_name: ${{ github.event.pull_request.title }} | |
| body: ${{ github.event.pull_request.body }} | |
| draft: false | |
| prerelease: false | |
| publish: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install poetry | |
| uses: snok/[email protected] | |
| - name: Build a binary wheel and a source tarball | |
| run: poetry build | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/[email protected] |