Created the GitHub Actions step Upload to PyPi to run only on

tagged releases of anki:
https://anki.tenderapp.com/discussions/ankidesktop/40025-anki-in-python-package-index
This commit is contained in:
evandrocoan 2020-04-01 23:01:48 -03:00
parent 70a1992f70
commit 069cc11a86
11 changed files with 76 additions and 19 deletions

View file

@ -239,3 +239,25 @@ jobs:
with:
name: ${{ matrix.ANKI_PYTHON_WHEELS }}
path: dist
- name: Upload to PyPi Windows
if: matrix.BUILD_TYPE == 'build' && startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest'
shell: cmd
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: __token__
run: |
echo on
rm -f "dist/%pyaudio%"
python -m pip install twine
twine upload --non-interactive --skip-existing --verbose dist/*
- name: Upload to PyPi Linux/Mac OS
if: matrix.BUILD_TYPE == 'build' && startsWith(github.ref, 'refs/tags/') && ( matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' )
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: __token__
run: |
set -x
python -m pip install twine
twine upload --non-interactive --skip-existing --verbose dist/*

View file

@ -52,7 +52,7 @@ PROTODEPS := $(wildcard ../proto/*.proto)
python -m black anki/hooks.py
@touch $@
BUILD_STEPS := .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks
BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks
# Checking
######################
@ -111,3 +111,9 @@ develop: $(BUILD_STEPS)
anki/buildinfo.py: ../meta/version ../meta/buildhash
echo "buildhash='$$(cat ../meta/buildhash)'" > $@
echo "version='$$(cat ../meta/version)'" >> $@
VER := $(shell cat ../meta/version)
.build/vernum: ../meta/version
sed -i.bak 's/.*automatically updated.*/ version="$(VER)", # automatically updated/' setup.py
rm setup.py.bak
@touch $@

4
pylib/pyproject.toml Normal file
View file

@ -0,0 +1,4 @@
[build-system]
# Minimum requirements for the build system to execute.
# https://stackoverflow.com/questions/48048745/setup-py-require-a-recent-version-of-setuptools-before-trying-to-install
requires = ["setuptools", "wheel"]

View file

@ -1,11 +1,31 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import setuptools
with open("../meta/version") as fh:
version = fh.read().strip()
minimum_python_version = (3, 7)
if sys.version_info < minimum_python_version:
raise RuntimeError(
"The minimum Python interpreter version required for Anki is '%s' "
"and version '%s' was found!" % (minimum_python_version, sys.version_info)
)
install_requires = [
"beautifulsoup4",
"requests",
"decorator",
"protobuf",
'orjson; platform_machine == "x86_64"',
'psutil; sys_platform == "win32"',
'distro; sys_platform != "darwin" and sys_platform != "win32"',
]
setuptools.setup(
name="anki",
version=version,
version="2.1.24", # automatically updated
author="Ankitects Pty Ltd",
description="Anki's library code",
long_description="Anki's library code",
@ -16,13 +36,5 @@ setuptools.setup(
package_data={"anki": ["py.typed"]},
classifiers=[],
python_requires=">=3.7",
install_requires=[
"beautifulsoup4",
"requests",
"decorator",
"protobuf",
'orjson; platform_machine == "x86_64"',
'psutil; sys_platform == "win32"',
'distro; sys_platform != "darwin" and sys_platform != "win32"',
],
install_requires=install_requires,
)

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import setuptools

View file

@ -1,9 +1,11 @@
[package]
name = "anki"
version = "2.1.24" # automatically updated
version = "2.1.24" # automatically updated
edition = "2018"
authors = ["Ankitects Pty Ltd and contributors"]
authors = ["Ankitects Pty Ltd and contributors <pypi@cargo.bug>"]
license = "AGPL-3.0-or-later"
description = "Anki's Rust library code"
readme = "README.md"
[dependencies]
nom = "5.0.1"

View file

@ -49,6 +49,6 @@ RUST_TOOLCHAIN := $(shell cat rust-toolchain)
VER := $(shell cat ../meta/version)
.build/vernum: ../meta/version
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
rm Cargo.toml.bak
@touch $@

3
rslib/README.md Normal file
View file

@ -0,0 +1,3 @@
Anki's Rust library code
https://anki.tenderapp.com/discussions/ankidesktop/40025-anki-in-python-package-index

View file

@ -1,8 +1,11 @@
[package]
name = "ankirspy"
version = "2.1.24" # automatically updated
version = "2.1.24" # automatically updated
edition = "2018"
authors = ["Ankitects Pty Ltd and contributors"]
authors = ["Ankitects Pty Ltd and contributors <pypi@cargo.bug>"]
license = "AGPL-3.0-or-later"
description = "Anki's Rust library code Python bindings"
readme = "README.md"
[dependencies]
anki = { path = "../rslib" }

View file

@ -91,6 +91,6 @@ RUST_TOOLCHAIN := $(shell cat rust-toolchain)
VER := $(shell cat ../meta/version)
.build/vernum: ../meta/version
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
rm Cargo.toml.bak
@touch $@

3
rspy/README.md Normal file
View file

@ -0,0 +1,3 @@
Anki's Rust library code Python bindings
https://anki.tenderapp.com/discussions/ankidesktop/40025-anki-in-python-package-index