Skip to content

Commit 0287dee

Browse files
committed
revert pipeline from using published action
1 parent 5d19e5c commit 0287dee

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.github/scripts/version_check.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# This script is copied directly from https://github.com/MathieuMoalic/action-python-package-new-version/blob/main/entrypoint.sh
44
# This is just until there is extra functionality as part of that repo to allow specifying a different index.
55

6+
########## helper ##########
7+
error_exit() {
8+
echo "Error: $1" >&2
9+
exit 1
10+
}
11+
612
# Check if pyproject.toml exists
713
PYPROJECT_FILE=pyproject.toml
814

@@ -18,15 +24,15 @@ fi
1824
echo "Version is $VERSION"
1925

2026
# Step 2: Get package name from pyproject.toml
21-
PACKAGE_NAME=$(awk -F'=' '/^name/ {gsub(/[" ]/, "", $2); print $2}' "$PYPROJECT_FILE")
27+
PACKAGE_NAME=$(awk -F'=' '/^name/ {gsub(/[" ]/, "", $2); print $2;exit;}' "$PYPROJECT_FILE")
2228
if [ -z "$PACKAGE_NAME" ]; then
2329
error_exit "Unable to extract package name from $PYPROJECT_FILE"
2430
fi
25-
echo "PACKAGE_NAME is $PACKAGE_NAME"
31+
echo "PACKAGE_NAME is ${PACKAGE_NAME}..."
2632

2733
# Step 3: Get latest release version from PyPI
2834
INDEX="${PYPI_INDEX:-pypi.org}"
29-
PUBLISHED_VERSIONS=$(curl -s "https://$INDEX/pypi/$PACKAGE_NAME/json" | jq -r '.releases | keys | .[]')
35+
PUBLISHED_VERSIONS=$(curl -s "https://${INDEX}/pypi/${PACKAGE_NAME}/json" | jq -r '.releases | keys | .[]')
3036

3137
if [ -z "$PUBLISHED_VERSIONS" ]; then
3238
error_exit "Unable to retrieve published version from $INDEX for $PACKAGE_NAME"
@@ -44,5 +50,6 @@ done
4450

4551
echo "PUBLISHING is $PUBLISHING"
4652
echo "PUBLISHING=$PUBLISHING" >> $GITHUB_ENV
53+
echo "PUBLISHING_${INDEX/./_}=$PUBLISHING"
4754
echo "PUBLISHING_${INDEX/./_}=$PUBLISHING" >> $GITHUB_ENV
4855
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV

.github/workflows/pipeline.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ jobs:
5757
- uses: actions/checkout@v4
5858
with:
5959
fetch-depth: 0
60-
- name: Check whether to release on indexes
61-
uses: MathieuMoalic/action-python-package-new-version@c4e361a9d28c1bcc19fe10bb4dcb751b625f031b
60+
- name: Check whether to release on pypi.org
61+
run: |
62+
./.github/scripts/version_check.sh
63+
- name: Check whether to release on test.pypi.org
64+
run: |
65+
export PYPI_INDEX=test.pypi.org
66+
./.github/scripts/version_check.sh
6267
- name: Globalise determined version
6368
id: set_version
6469
run: echo "package_version=${{ env.PACKAGE_VERSION }}" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)