From 195890371ae40b6fd2e0466fd2c15cdb63adca8d Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Fri, 24 Feb 2023 18:49:47 +0900 Subject: [PATCH] update upload scripts --- cargo_publish.ps1 | 23 +++++++++++++++-------- cargo_publish.sh | 22 ++++++++++++++-------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/cargo_publish.ps1 b/cargo_publish.ps1 index 66392fe..f02eae7 100644 --- a/cargo_publish.ps1 +++ b/cargo_publish.ps1 @@ -1,14 +1,21 @@ if ($PWD.Path -eq "$HOME\GitHub\pylyzer") { - cd crates/py2erg - echo "publish py2erg ..." - cargo publish - # from cargo 1.66 timeout is not needed - # timeout 12 - cd ../../ - cargo publish + if ($null -eq $env:PYPI_PASSWORD) { + echo "set PYPI_PASSWORD environment variable" + exit + } + if ($args[0] -ne "--pip-only") { + cd crates/py2erg + echo "publish py2erg ..." + cargo publish + # from cargo 1.66 timeout is not needed + # timeout 12 + cd ../../ + cargo publish + } maturin build --release $ver = cat Cargo.toml | rg "^version =" | sed -r 's/^version = "(.*)"/\1/' - python -m twine upload "target/wheels/pylyzer-$ver-py3-none-win_amd64.whl" -u mtshiba -p $env:PYPI_PASSWORD + $whl = "target/wheels/$(ls target/wheels | Select-Object -ExpandProperty Name | rg "pylyzer-$ver")" + python -m twine upload $whl -u mtshiba -p $env:PYPI_PASSWORD echo "completed" } else { echo "use this command in the project root" diff --git a/cargo_publish.sh b/cargo_publish.sh index 0937eec..a33aa57 100755 --- a/cargo_publish.sh +++ b/cargo_publish.sh @@ -1,14 +1,20 @@ if [ "$PWD" = "$HOME/github/pylyzer" ]; then - cd crates/py2erg - echo "publish py2erg ..." - cargo publish - # from cargo 1.66 timeout is not needed - # timeout 12 - cd ../../ - cargo publish + if [ "$PYPI_PASSWORD" = "" ]; then + echo "set PYPI_PASSWORD" + exit 1 + fi + if [ "$1" != "--pip-only" ]; then + cd crates/py2erg + echo "publish py2erg ..." + cargo publish + # from cargo 1.66 timeout is not needed + # timeout 12 + cd ../../ + cargo publish + fi maturin build --release ver=`cat Cargo.toml | rg "^version =" | sed -r 's/^version = "(.*)"/\1/'` - whl=`ls target/wheels | rg "pylyzer-$ver"` + whl=target/wheels/`ls target/wheels | rg "pylyzer-$ver"` python3 -m twine upload $whl -u mtshiba -p $PYPI_PASSWORD echo "completed" else