Skip to content

Update names binaries files #21

Update names binaries files

Update names binaries files #21

name: Build and publish platform wheels
on:
push:
tags:
- "v*"
jobs:
build-and-publish:
name: Build wheel for ${{ matrix.folder }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- folder: win-x86
plat_tag: win32
runner: windows-latest
shell: cmd
- folder: win-x64
plat_tag: win_amd64
runner: windows-latest
shell: cmd
- folder: win-arm64
plat_tag: win_arm64
runner: windows-latest
shell: cmd
- folder: linux-x64
plat_tag: linux_x86_64
runner: ubuntu-latest
shell: bash
- folder: linux-arm64
plat_tag: linux_aarch64
runner: ubuntu-latest
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Prepare scripts directory (Windows)
if: matrix.runner == 'windows-latest'
shell: cmd
run: |
echo Verificando archivo .bat en src\initvenv\scripts...
if not exist "src\initvenv\scripts\initvenv.bat" (
echo Error: No se encontró src\initvenv\scripts\initvenv.bat
exit 1
) else (
echo ✓ src\initvenv\scripts\initvenv.bat encontrado
)
rem Limpia cualquier initvenv.exe anterior en el paquete
if exist "src\initvenv\scripts\initvenv.exe" (
del /Q "src\initvenv\scripts\initvenv.exe"
echo Eliminado initvenv.exe previo en src\initvenv\scripts
)
echo Copiando .exe desde src\initvenv\bin\${{ matrix.folder }}
if exist "src\initvenv\bin\${{ matrix.folder }}\initvenv.exe" (
copy /Y "src\initvenv\bin\${{ matrix.folder }}\initvenv.exe" "src\initvenv\scripts\initvenv.exe"
echo ✓ Copiado initvenv.exe a src\initvenv\scripts\initvenv.exe
) else (
echo Error: no se encontró src\initvenv\bin\${{ matrix.folder }}\initvenv.exe
exit 1
)
- name: Prepare scripts directory (Linux)
if: matrix.runner == 'ubuntu-latest'
shell: bash
run: |
echo "Verifying binary in src/initvenv/bin/${{ matrix.folder }}"
if [ ! -f "src/initvenv/bin/${{ matrix.folder }}/initVenv" ]; then
echo "Error: src/initvenv/bin/${{ matrix.folder }}/initVenv not found"
exit 1
else
echo "✓ src/initvenv/bin/${{ matrix.folder }}/initVenv found"
fi
# Clean any previous initvenv in scripts
if [ -f "src/initvenv/scripts/initvenv" ]; then
rm -f "src/initvenv/scripts/initvenv"
echo "Removed previous initvenv in src/initvenv/scripts"
fi
echo "Copying binary from src/initvenv/bin/${{ matrix.folder }}"
cp "src/initvenv/bin/${{ matrix.folder }}/initVenv" "src/initvenv/scripts/initvenv"
echo "✓ Copied initVenv to src/initvenv/scripts/initvenv"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine wheel setuptools
- name: Build wheel
run: python -m build --wheel
- name: Rename wheel to platform tag
shell: pwsh
run: |
# Selecciona el wheel más reciente en dist/
$w = Get-ChildItem -Path dist -Filter "*.whl" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if (-not $w) { throw "Wheel not found in dist/ after build" }
$old = $w.Name
$plat = "${{ matrix.plat_tag }}"
# Si el filename contiene 'py3-none-any', reemplázalo; si no, inserta el tag antes de la extensión
if ($old -match 'py3-none-any') {
$new = $old -replace 'py3-none-any', "py3-none-$plat"
} else {
$base = [System.IO.Path]::GetFileNameWithoutExtension($old)
$ext = [System.IO.Path]::GetExtension($old)
$new = "$base-$plat$ext"
}
Write-Host "Renaming $old -> $new"
Rename-Item -Path $w.FullName -NewName $new
- name: Publish wheel to PyPI
env:
TWINE_USERNAME: __token__
# Test
# TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_TEST }}
# Production
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD }}
# Prodcution
run: python -m twine upload dist/*.whl
# Test
# run: python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*.whl
- name: Upload artifact (wheel)
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.plat_tag }}
path: dist/*.whl
permissions:
contents: read
packages: write