Skip to content

Commit

Permalink
check for environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Nov 28, 2023
1 parent be2328e commit 09e79df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
python-version: "3.x" # Use the latest version of Python 3

- name: Install Flit
run: python -m pip install flit
- name: Install Twine
run: python -m pip install --upgrade pip && python -m pip install --upgrade twine

- name: Publish to PyPI
run: flit publish --repository pypi
- name: Upload to PyPI using script
run: bash scripts/upload_latest.sh
env:
FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
17 changes: 14 additions & 3 deletions scripts/upload_latest.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash

# Source the .env file to export the TWINE_USERNAME and TWINE_PASSWORD
# Check if there is a .env file with TWINE_USERNAME and TWINE_PASSWORD
# or if the environment variables are already set.
if [ -f ".env" ]; then
echo "Overwriting TWINE_USERNAME and TWINE_PASSWORD environment variables from .env"
export $(cat .env | xargs)
else
echo ".env file not found"
exit 1
echo "Checking for TWINE_USERNAME and TWINE_PASSWORD environment variables..."

if [ -z "$TWINE_USERNAME" ]; then
echo "TWINE_USERNAME environment variable was not set"
exit 1
fi

if [ -z "$TWINE_PASSWORD" ]; then
echo "TWINE_PASSWORD environment variable was not set"
exit 1
fi
fi

# Navigate to the dist directory
Expand Down

0 comments on commit 09e79df

Please sign in to comment.