From a195db2d7a0c21b02b2823e63c944efff642c090 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Mon, 9 Dec 2024 19:54:51 +0100 Subject: [PATCH] Remove preupload check from release workflow 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. --- .../scripts/publish_client_gem.sh.j2 | 13 +++---------- .../scripts/publish_client_pypi.sh.j2 | 19 +++++++------------ .../scripts/publish_plugin_pypi.sh.j2 | 17 +++++------------ 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/templates/github/.github/workflows/scripts/publish_client_gem.sh.j2 b/templates/github/.github/workflows/scripts/publish_client_gem.sh.j2 index 09baf18b..ecf1f200 100755 --- a/templates/github/.github/workflows/scripts/publish_client_gem.sh.j2 +++ b/templates/github/.github/workflows/scripts/publish_client_gem.sh.j2 @@ -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 %} diff --git a/templates/github/.github/workflows/scripts/publish_client_pypi.sh.j2 b/templates/github/.github/workflows/scripts/publish_client_pypi.sh.j2 index 01834aca..99f398d7 100755 --- a/templates/github/.github/workflows/scripts/publish_client_pypi.sh.j2 +++ b/templates/github/.github/workflows/scripts/publish_client_pypi.sh.j2 @@ -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 %} +; diff --git a/templates/github/.github/workflows/scripts/publish_plugin_pypi.sh.j2 b/templates/github/.github/workflows/scripts/publish_plugin_pypi.sh.j2 index c172a6f9..f23030cf 100755 --- a/templates/github/.github/workflows/scripts/publish_plugin_pypi.sh.j2 +++ b/templates/github/.github/workflows/scripts/publish_plugin_pypi.sh.j2 @@ -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" \ ;