Skip to content

Commit 1778aad

Browse files
committed
PyPI publisher is simplified
1 parent 02bd3a6 commit 1778aad

File tree

2 files changed

+5
-61
lines changed

2 files changed

+5
-61
lines changed

actions/publish_pypi/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ Used to build and publish packages to internal and public package indexes using
77
```yaml
88
steps:
99
- name:
10-
uses: neuralmagic/nm-actions/actions/publisher@main
10+
uses: neuralmagic/nm-actions/actions/publish_pypi@main
1111
with:
12-
publish_pypi: false
12+
publish_pypi: true
1313
publish_pypi_internal: true
14-
timestamp: true
15-
prefix: "-nightly"
16-
build_number: ${{ github.event.pull_request.number }}
14+
build_type: 'release'
1715
```

actions/publish_pypi/action.yml

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ inputs:
1010
description: "Publish the distribution to the pypi.org"
1111
required: true
1212

13-
built_type:
14-
description: "Applies a set of rules depending on the environment. Available values: (dev|release|nightly|custom)"
13+
build_type:
14+
description: "Applies a set of rules depending on the environment. Available values: (dev|release|nightly)"
1515
required: true
1616

17-
custom_package_name:
18-
description: "Custom package name could be used along wtih the 'custom' build_type"
19-
required: false
20-
2117
outputs:
2218
whlname:
2319
description: "wheel filename"
@@ -36,10 +32,6 @@ runs:
3632
echo "Error: At least one of 'publish_pypi' or 'publish_pypi_internal' must be set to 'true'"
3733
exit 1
3834
fi
39-
if [ "${{ inputs.built_type }}" == "custom" ] && [ "${{ inputs.custom_package_name }}" == "" ]; then
40-
echo "Error: If 'built_type' is set to 'custom' the 'custom_package_name' must be specified"
41-
exit 1
42-
fi
4335
4436
- name: Install tox
4537
run: python3 -m pip install --user tox build
@@ -49,52 +41,6 @@ runs:
4941
run: |
5042
python3 -m tox -e build
5143
52-
# suffixes dispatcher
53-
SUFFIX=""
54-
case ${{ inputs.built_type }} in
55-
"dev")
56-
SUFFIX="-dev-${{ github.event.pull_request.number }}"
57-
;;
58-
"nightly")
59-
SUFFIX="-nightly-$(date +%Y%m%d)"
60-
;;
61-
"staging")
62-
;;
63-
"release")
64-
;;
65-
"custom")
66-
if [[ -z ${{ inputs.custom_package_name }} ]]; then
67-
echo "Error: Custom build_type requires a custom_package_name input"
68-
exit 1
69-
fi
70-
SUFFIX=""
71-
;;
72-
*)
73-
echo "Invalid build_type: ${{ inputs.built_type }}"
74-
exit 1
75-
esac
76-
77-
echo "::set-output name=suffix::$SUFFIX"
78-
79-
- name: Rename build artifacts
80-
run: |
81-
# Retrieve package name from previous step
82-
PACKAGE_NAME="${{ inputs.custom_package_name || 'guidellm' }}"
83-
84-
# Extract version from distribution file name (e.g., guidellm-1.2.3-dev.whl)
85-
VERSION=$(find dist -name "*.whl" | cut -d '-' -f 2)
86-
87-
# Generate final file name based on build_type and package name
88-
NEW_NAME="${PACKAGE_NAME}${SUFFIX}-${VERSION}.whl"
89-
TAR_NAME="${PACKAGE_NAME}${SUFFIX}-${VERSION}.tar.gz"
90-
91-
mv dist/* dist/$NEW_NAME
92-
cp dist/$NEW_NAME dist/$TAR_NAME
93-
94-
# Set outputs for subsequent steps
95-
echo "::set-output name=whlname::$NEW_NAME"
96-
echo "::set-output name=tarname::$TAR_NAME"
97-
9844
- name: Authenticate to GCP
9945
uses: google-github-actions/[email protected]
10046
with:

0 commit comments

Comments
 (0)