-
Notifications
You must be signed in to change notification settings - Fork 7
48 lines (40 loc) · 1.36 KB
/
Copy pathpublish-dev.yml
File metadata and controls
48 lines (40 loc) · 1.36 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
name: Publish Dev to PyPI
on:
push:
branches:
- dev
jobs:
publish-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Necesario para contar commits
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build tools
run: pip install build twine
- name: Generate dev version
id: version
run: |
# Obtener la versión base del pyproject.toml
BASE_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml)
# Contar commits desde el último tag o desde el inicio
COMMIT_COUNT=$(git rev-list --count HEAD)
# Crear versión dev: X.Y.Z.devN
DEV_VERSION="${BASE_VERSION}.dev${COMMIT_COUNT}"
echo "dev_version=${DEV_VERSION}" >> $GITHUB_OUTPUT
echo "Building dev version: ${DEV_VERSION}"
- name: Update version in pyproject.toml
run: |
sed -i "s/^version = .*/version = \"${{ steps.version.outputs.dev_version }}\"/" pyproject.toml
cat pyproject.toml | grep version
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*