Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action to get latest package versions on pypi #28

Merged
merged 6 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions actions/get-pypi-latest-versions/action.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions actions/verify-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down