git workflow

This commit is contained in:
Junzi Sun 2024-08-25 13:38:06 +02:00
parent fdfa2b3fab
commit b4be55116c
4 changed files with 19 additions and 70 deletions

16
.github/workflows/build-publish.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: build and publish
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.0
with:
poetry_version: "==1.8.2"
pypi_token: ${{ secrets.PYPI_API_TOKEN_PYMODES }}

View File

@ -1,67 +0,0 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: publish
on:
release:
types: [created]
workflow_dispatch:
env:
POETRY_VERSION: "1.6.1"
jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Add poetry to windows path
if: "startsWith(runner.os, 'windows')"
run: |
echo "C:\Users\runneradmin\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install and configure Poetry
uses: snok/install-poetry@v1.4.0
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Display Python version
run: poetry run python -c "import sys; print(sys.version)"
- name: Build packages
run: poetry build
- name: Install dependencies
run: |
poetry run pip install --upgrade pip
poetry run pip install twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry run twine upload dist/*.whl
- name: Build and publish (source)
if: ${{ startsWith(runner.os, 'windows') && matrix.python-version == '3.11' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry run twine upload dist/*.tar.gz

4
poetry.lock generated
View File

@ -877,5 +877,5 @@ rtlsdr = ["pyrtlsdr"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.9" python-versions = ">=3.9"
content-hash = "99bee66d485fec146c4951b52b6d29ccd68254e733f12af4493bac432cb9b434" content-hash = "f92c8f8bdcbe5a3351cbe1c026b19b913c9b4502e6ecc3a35b3cbef4d48fee7d"

View File

@ -29,7 +29,7 @@ build = "build.py"
modeslive = "pyModeS.streamer.modeslive:main" modeslive = "pyModeS.streamer.modeslive:main"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.9" python = ">=3.9"
numpy = ">=1.26" numpy = ">=1.26"
pyzmq = ">=24.0" pyzmq = ">=24.0"
pyrtlsdr = { version = ">=0.2.93", optional = true } pyrtlsdr = { version = ">=0.2.93", optional = true }