Skip to content

Commit

Permalink
Remove preupload check from release workflow
Browse files Browse the repository at this point in the history
This check is broken and prevents any further releases to be published
to PyPi. But also it outlived it's purpose. In the current state of the
release process it would actually be better to let the workflow job
rightfully fail.
  • Loading branch information
mdellweg committed Dec 9, 2024
1 parent 4d4b717 commit a195db2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,16 @@ cd "$(dirname "$(realpath -e "$0")")"/../../..

VERSION="$1"

if [[ -z "$VERSION" ]]; then
if [[ -z "${VERSION}" ]]
then
echo "No version specified."
exit 1
fi

RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://rubygems.org/gems/{{ plugin_name | snake }}_client/versions/$VERSION")"

if [ "$RESPONSE" == "200" ];
then
echo "{{ plugin_name }} client $VERSION has already been released. Skipping."
exit
fi

mkdir -p ~/.gem
touch ~/.gem/credentials
echo "---
:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials
sudo chmod 600 ~/.gem/credentials

{%- for plugin in plugins %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ cd "$(dirname "$(realpath -e "$0")")/../../.."

VERSION="$1"

if [[ -z "$VERSION" ]]; then
if [[ -z "${VERSION}" ]]
then
echo "No version specified."
exit 1
fi
{%- for plugin in plugins %}

RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/{{ plugin.name | dash }}-client/$VERSION/")"

if [ "$RESPONSE" == "200" ];
then
echo "{{ plugin.name }} client $VERSION has already been released. Skipping."
else
twine upload -u __token__ -p "$PYPI_API_TOKEN" \
"dist/{{ plugin.name | snake }}_client-$VERSION-py3-none-any.whl" \
"dist/{{ plugin.name | snake }}-client-$VERSION.tar.gz"
fi
twine upload -u __token__ -p "${PYPI_API_TOKEN}" \
{%- for plugin in plugins %}
"dist/{{ plugin.name | snake }}_client-${VERSION}-py3-none-any.whl" \
"dist/{{ plugin.name | snake }}-client-${VERSION}.tar.gz" \
{%- endfor %}
;
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ cd "$(dirname "$(realpath -e "$0")")"/../../..

VERSION="$1"

if [[ -z "$VERSION" ]]; then
if [[ -z "${VERSION}" ]]
then
echo "No version specified."
exit 1
fi

RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/{{ plugin_name | dash }}/$VERSION/")"

if [ "$RESPONSE" == "200" ];
then
echo "{{ plugin_name }} $VERSION has already been released. Skipping."
exit
fi

twine upload -u __token__ -p "$PYPI_API_TOKEN" \
dist/{{ plugin_name | snake | replace("_", "?") }}-"$VERSION"-py3-none-any.whl \
dist/{{ plugin_name | snake | replace("_", "?") }}-"$VERSION".tar.gz \
twine upload -u __token__ -p "${PYPI_API_TOKEN}" \
"dist/{{ plugin_name | snake | replace("_", "?") }}-${VERSION}-py3-none-any.whl" \
"dist/{{ plugin_name | snake | replace("_", "?") }}-${VERSION}.tar.gz" \
;

0 comments on commit a195db2

Please sign in to comment.