Publish to Guardrails Hub #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Guardrails Hub | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
env: | |
GUARDRAILS_TOKEN: ${{ secrets.GR_GUARDRAILS_TOKEN }} | |
PYPI_REPOSITORY_URL: 'https://pypi.guardrailsai.com' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Twine & Build | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
pip install twine build toml | |
- name: Create .pypirc | |
shell: bash | |
run: | | |
touch ~/.pypirc | |
echo "[distutils]" >> ~/.pypirc | |
echo "index-servers =" >> ~/.pypirc | |
echo " private-repository" >> ~/.pypirc | |
echo "" >> ~/.pypirc | |
echo "[private-repository]" >> ~/.pypirc | |
echo "repository = $PYPI_REPOSITORY_URL" >> ~/.pypirc | |
echo "username = __token__" >> ~/.pypirc | |
echo "password = $GUARDRAILS_TOKEN" >> ~/.pypirc | |
- name: Build & Upload | |
shell: bash | |
run: | | |
python -m build | |
twine upload dist/* -u __token__ -p $GUARDRAILS_TOKEN -r private-repository |