Skip to content

Commit

Permalink
attempt to fix push to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariana Barzinpour committed Sep 21, 2023
1 parent 9924bac commit 6514916
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ jobs:
- name: Config
id: cfg
run: |
push_test_pypi=no
push_pypi=no
if "${GITHUB_REF}" in "refs/heads/fix_pypi_action"; then
push_test_pypi=yes
fi
if "${GITHUB_REF}" in "refs/tags/"*; then
echo "push_pypi=yes" >> $GITHUB_OUTPUT
push_test_pypi=yes
push_pypi=yes
fi
for x in push_test_pypi push_pypi; do
echo "${x}=${!x}" >> $GITHUB_OUTPUT
done
- uses: dorny/paths-filter@v2
id: changes
if: |
Expand Down Expand Up @@ -120,6 +131,30 @@ jobs:
twine check ./dist/*
EOF
- name: Publish to Test PyPi
if: |
steps.cfg.outputs.push_test_pypi == 'yes'
run: |
if [ -n "${TWINE_PASSWORD}" ]; then
docker run --rm \
-v $(pwd):/code \
-e SKIP_DB=yes \
${{ env.DOCKER_IMAGE }} \
twine upload \
--verbose \
--non-interactive \
--disable-progress-bar \
--username=__token__ \
--password=${TWINE_PASSWORD} \
--repository-url=${TWINE_REPOSITORY_URL} \
--skip-existing dist/* || true
else
echo "Skipping upload as 'TestPyPiToken' is not set"
fi
env:
TWINE_PASSWORD: ${{ secrets.TestPyPiToken }}
TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'

- name: Publish to PyPi
if: |
github.event_name == 'push'
Expand Down

0 comments on commit 6514916

Please sign in to comment.