-
Notifications
You must be signed in to change notification settings - Fork 3
73 lines (62 loc) · 2.08 KB
/
release.yml
File metadata and controls
73 lines (62 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # 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/tilebench
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@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1