-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.71 KB
/
Copy pathpublish-dev.yml
File metadata and controls
61 lines (51 loc) · 1.71 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
name: Publish drp-dev to PyPI
# Dev branch → publishes "drp-dev" package.
# No tags, no GitHub releases — just PyPI.
on:
push:
branches: [dev]
paths:
- 'cli/**'
- 'pyproject.toml'
- 'VERSION'
- '.github/workflows/publish-dev.yml'
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: publish-dev
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Compute version from PyPI
id: version
run: |
base=$(cat VERSION | tr -d '[:space:]')
pkg="drp-dev"
latest=$(curl -sf "https://pypi.org/pypi/${pkg}/json" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['info']['version'])" 2>/dev/null || echo "")
if [ -n "$latest" ] && echo "$latest" | grep -q "^${base}\."; then
patch=$(echo "$latest" | cut -d. -f3)
version="${base}.$((patch + 1))"
else
version="${base}.0"
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Publishing ${pkg} ${version} (latest on PyPI: ${latest:-none})"
- name: Stamp version
run: echo '${{ steps.version.outputs.version }}' > VERSION
- name: Stamp __version__ in cli/__init__.py
run: echo "__version__ = '${{ steps.version.outputs.version }}'" > cli/__init__.py
- name: Build drp-dev
run: pip install build && python -m build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}