-
Notifications
You must be signed in to change notification settings - Fork 60
104 lines (84 loc) · 3.14 KB
/
Copy pathrelease_beta.yaml
File metadata and controls
104 lines (84 loc) · 3.14 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release Beta
on:
workflow_dispatch:
inputs:
increment_version:
description: "Increment version by major, minor, or patch"
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch
env:
CHANGELOG_FILE_PATH: CHANGELOG.md
jobs:
run-tests:
uses: ./.github/workflows/tests.yaml
release-beta:
runs-on: ubuntu-latest
needs: run-tests
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.7"
enable-cache: true
- name: Set version
run: |
CURRENT_VERSION=$(uv version --short)
echo "Current version: $CURRENT_VERSION"
uv version --bump "${{ inputs.increment_version }}" --frozen
NEW_VERSION=$(uv version --short)
echo "New version: $NEW_VERSION"
echo "RELEASE_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"
NEW_VERSION="$NEW_VERSION" python - <<'PY'
import os
import re
from pathlib import Path
version = os.environ["NEW_VERSION"]
path = Path("nest/__init__.py")
text = path.read_text()
updated = re.sub(
r'^__version__ = "[^"]+"$',
f'__version__ = "{version}"',
text,
flags=re.MULTILINE,
)
if updated == text:
raise SystemExit("Could not update nest/__init__.py version")
path.write_text(updated)
PY
- name: Install build dependencies
run: uv sync --no-dev --group build
- name: Update CHANGELOG.md
run: uv run git-changelog . -o "$CHANGELOG_FILE_PATH"
- name: Build package
run: uv build --sdist --wheel
- name: Check package metadata
run: uv run twine check dist/*
- name: Smoke test wheel
run: uv run --isolated --no-project --with dist/*.whl python -c "import nest; from nest.cli.cli import nest_cli; print(nest.__version__)"
- name: Smoke test source distribution
run: uv run --isolated --no-project --with dist/*.tar.gz python -c "import nest; from nest.cli.cli import nest_cli; print(nest.__version__)"
- name: Publish package to TestPyPI
env:
UV_PUBLISH_USERNAME: ${{ secrets.TEST_PYPI_API_USER }}
UV_PUBLISH_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: uv publish --publish-url https://test.pypi.org/legacy/ --check-url https://test.pypi.org/simple/
- name: Install test package
run: |
uv venv .testpypi-venv
uv pip install --python .testpypi-venv/bin/python --index-url https://test.pypi.org/simple/ --no-deps "pynest-api==$RELEASE_VERSION"
.testpypi-venv/bin/python -c "import nest; print(nest.__version__)"
- name: Copy pip url
run: echo "pip install --index-url https://test.pypi.org/simple/ --no-deps pynest-api==$RELEASE_VERSION"