Debian Codegraph @

.github/workflows/release.yml

raw
1 name: Release
2
3 on:
4 push:
5 tags:
6 - '*'
7 env:
8 LATEST_PY_VERSION: '3.14'
9
10 jobs:
11 build:
12 name: Build dist
13 runs-on: ubuntu-latest
14 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
15 steps:
16 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
18 - name: Install uv
19 uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
20 with:
21 version: "0.9.*"
22 enable-cache: true
23 python-version: ${{ env.LATEST_PY_VERSION }}
24
25 - name: Install dependencies
26 run: |
27 uv sync --group deploy
28
29 - name: Set tag version
30 id: tag
31 run: |
32 echo "version=${GITHUB_REF#refs/*/}"
33 echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
34
35 - name: Set module version
36 id: module
37 run: |
38 echo "version=$(uv run hatch --quiet version)" >> $GITHUB_OUTPUT
39
40 - name: Check version match
41 run: |
42 if [ "${{ steps.tag.outputs.version }}" != "${{ steps.module.outputs.version }}" ]; then
43 echo "Tag version (${{ steps.tag.outputs.version }}) does not match module version (${{ steps.module.outputs.version }})"
44 exit 1
45 fi
46
47 - name: Build
48 run: |
49 uv run hatch build
50
51 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
52 with:
53 path: ./dist/
54
55 upload_pypi:
56 name: Upload release to PyPI
57 needs: [build]
58 runs-on: ubuntu-latest
59 environment:
60 # Note: this environment must be configured in the repo settings
61 name: pypi-release
62 url: https://pypi.org/p/geojson-pydantic
63 permissions:
64 id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
65 steps:
66 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
67 with:
68 name: artifact
69 path: dist
70 merge-multiple: true
71
72 - name: Publish package distributions to PyPI
73 uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2