diff --git a/actions/get-pypi-latest-versions/action.yml b/actions/get-pypi-latest-versions/action.yml new file mode 100644 index 0000000..9aa8b10 --- /dev/null +++ b/actions/get-pypi-latest-versions/action.yml @@ -0,0 +1,36 @@ +--- +name: get package latest versions on PyPi +description: get package latest versions on PyPi + +inputs: + package_name: + description: name of the package + required: true + num_of_latest: + description: number of latest versions + default: 1 + +outputs: + versions: + description: return latest versions (separated by ;) of package on PyPi + value: ${{ steps.getpypi.outputs.versions }} + +runs: + using: composite + steps: + - name: get package versions from pypi + id: getpypi + shell: bash + run: |- + URL="https://pypi.org/project/${{ inputs.package_name }}/#history" + curl --header 'Accept: application/vnd.pypi.simple.v1+json' ${URL} > history.log + all=`cat history.log | grep 'release__card' | sed 's/.*project\///g' | cut -d'/' -f2` + latest=${{ inputs.num_of_latest }} + if [[ -z "${{ inputs.num_of_latest }}" ]]; then + latest=1 + fi + versions=`echo "${all}" | head -${latest} | tr '\n' ';'` + echo "versions=${versions}" >> "$GITHUB_OUTPUT" + if [ -z "${versions}" ]; then + exit 1 + fi diff --git a/actions/verify-python/action.yml b/actions/verify-python/action.yml index b0fe0be..bb833e4 100644 --- a/actions/verify-python/action.yml +++ b/actions/verify-python/action.yml @@ -7,11 +7,6 @@ inputs: description: version of python to verify, e.g. 3.10 required: true -outputs: - version: - description: result from 'python --version' - value: ${{ steps.env_python.outputs.version }} - runs: using: composite steps: