File: publish

package info (click to toggle)
stactools 0.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,796 kB
  • sloc: python: 4,498; xml: 554; sh: 395; makefile: 34
file content (55 lines) | stat: -rwxr-xr-x 961 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
#!/bin/bash

set -e

if [[ -n "${CI}" ]]; then
    set -x
fi

function usage() {
    echo -n \
        "Usage: $(basename "$0")
Publish all stactools packages.

Options:
--test    Publish to test pypi
"
}

POSITIONAL=()
while [[ $# -gt 0 ]]
do
    key="$1"
    case $key in

        --help)
        usage
        exit 0
        shift
        ;;

        --test)
        TEST_PYPI="--repository testpypi"
        shift
        ;;

        *)    # unknown option
        POSITIONAL+=("$1") # save it in an array for later
        shift # past argument
        ;;
    esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

# Fail if this isn't CI and we aren't publishing to test pypi
if [ -z "${TEST_PYPI}" ] && [ -z "${CI}" ]; then
    echo "Only CI can publish to pypi"
    exit 1
fi

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
    rm -rf dist
    pip install build twine
    python -m build --sdist --wheel
    twine upload ${TEST_PYPI} dist/*
fi