Skip to content

Commit b7bb583

Browse files
committed
ci: update release process
1 parent d425095 commit b7bb583

2 files changed

Lines changed: 74 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ jobs:
5858
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
5959
with:
6060
version: "0.9.*"
61-
enable-cache: true
6261
python-version: ${{ env.LATEST_PY_VERSION }}
6362

6463
- name: Install dependencies
6564
run: |
66-
uv sync --group benchmark
65+
uv sync --group benchmark --frozen
6766
6867
- name: Run Benchmark
6968
run: |
@@ -84,41 +83,3 @@ jobs:
8483
# Make a commit on `gh-pages` only if main
8584
auto-push: ${{ github.ref == 'refs/heads/main' }}
8685
benchmark-data-dir-path: dev/benchmarks
87-
88-
publish:
89-
needs: [tests]
90-
runs-on: ubuntu-latest
91-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
92-
steps:
93-
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
94-
95-
- name: Install uv
96-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
97-
with:
98-
version: "0.9.*"
99-
enable-cache: true
100-
python-version: ${{ env.LATEST_PY_VERSION }}
101-
102-
- name: Install dependencies
103-
run: |
104-
uv sync --group deploy
105-
106-
- name: Set tag version
107-
id: tag
108-
run: |
109-
echo "version=${GITHUB_REF#refs/*/}"
110-
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
111-
112-
- name: Set module version
113-
id: module
114-
run: |
115-
echo "version=$(uv run hatch --quiet version)" >> $GITHUB_OUTPUT
116-
117-
- name: Build and publish
118-
if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}}
119-
env:
120-
HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }}
121-
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
122-
run: |
123-
uv run hatch build
124-
uv run hatch publish

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.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/morecantile
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@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1

0 commit comments

Comments
 (0)