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

Enhance Publish to GR PyPi Action to allow package folder input #1208

Merged
merged 1 commit into from
Jan 7, 2025
Merged
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
14 changes: 9 additions & 5 deletions .github/actions/validator_pypi_publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ inputs:
description: 'PyPi Repository URL'
required: false
default: 'https://pypi.guardrailsai.com'
package_directory:
description: 'Package Directory "validator" or "some_parent_folder/package"'
required: false
default: 'validator'

runs:
using: "composite"
steps:
- name: Checkout "Validator" Repository
uses: actions/checkout@v3
with:
path: 'validator'
path: ${{ inputs.package_directory }}

- name: Checkout "Action" repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -56,22 +60,22 @@ runs:
- name: Move CI Scripts to Validator
shell: bash
run: |
mv shared-ci-scripts/.github/actions/validator_pypi_publish/*.py ./validator
mv shared-ci-scripts/.github/actions/validator_pypi_publish/*.py ./${{ inputs.package_directory }}

- name: Rename Package
shell: bash
run: |
cd validator
cd ${{ inputs.package_directory }}
CONCATANATED_NAME=$(python concat_name.py ${{ inputs.validator_id }})
NEW_PEP_PACKAGE_NAME=$(python package_name_normalization.py $CONCATANATED_NAME)
VALIDATOR_FOLDER_NAME=$(echo $NEW_PEP_PACKAGE_NAME | tr - _)
mv ./validator ./$VALIDATOR_FOLDER_NAME
mv ./${{ inputs.package_directory }} ./$VALIDATOR_FOLDER_NAME
python add_build_prefix.py ./pyproject.toml $NEW_PEP_PACKAGE_NAME $VALIDATOR_FOLDER_NAME

- name: Build & Upload
shell: bash
run: |
cd validator
cd ${{ inputs.package_directory }}
python -m build
twine upload dist/* -u __token__ -p ${{ inputs.guardrails_token }} -r private-repository

Loading