name: Release on: push: tags: - '*' env: LATEST_PY_VERSION: '3.14' jobs: build: name: Build dist runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 with: version: "0.9.*" enable-cache: true python-version: ${{ env.LATEST_PY_VERSION }} - name: Install dependencies run: | uv sync --group deploy - name: Set tag version id: tag run: | echo "version=${GITHUB_REF#refs/*/}" echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - name: Set module version id: module run: | echo "version=$(uv run hatch --quiet version)" >> $GITHUB_OUTPUT - name: Check version match run: | if [ "${{ steps.tag.outputs.version }}" != "${{ steps.module.outputs.version }}" ]; then echo "Tag version (${{ steps.tag.outputs.version }}) does not match module version (${{ steps.module.outputs.version }})" exit 1 fi - name: Build run: | uv run hatch build - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: path: ./dist/ upload_pypi: name: Upload release to PyPI needs: [build] runs-on: ubuntu-latest environment: # Note: this environment must be configured in the repo settings name: pypi-release url: https://pypi.org/p/geojson-pydantic permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: name: artifact path: dist merge-multiple: true - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2