-
Notifications
You must be signed in to change notification settings - Fork 27
62 lines (49 loc) · 1.51 KB
/
release.yaml
File metadata and controls
62 lines (49 loc) · 1.51 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
name: release
permissions:
contents: read
on:
push:
tags:
- "*"
jobs:
release-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
- name: Build package
run: uv build
- name: Set up a fresh environment and run tests
run: |
uv venv
uv pip install dist/*.tar.gz
uv pip install dist/*.whl
uv pip install -e '.[test,estimate-area]'
uv run pytest
release:
runs-on: ubuntu-22.04
needs: release-test
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
- name: Compare tags
run: |
PKG_VERSION=$(uv run python -c "import pathlib, tomllib; data = tomllib.loads(pathlib.Path('pyproject.toml').read_text()); print(data['project']['version'])")
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]
- name: Build package
run: uv build
- name: Install Twine
run: |
uv venv
uv pip install twine
- name: Validate deployment
run: uv run twine check dist/*
- name: Run deployment
run: uv run twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}