Skip to content

Commit

Permalink
Merge pull request #823 from henrykironde/publish-token
Browse files Browse the repository at this point in the history
Change Matrix Token structure
  • Loading branch information
ethanwhite authored Oct 26, 2024
2 parents bf63874 + 08fe52c commit e917c09
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
strategy:
matrix:
index-url: ['https://test.pypi.org/legacy/', 'https://upload.pypi.org/legacy/']
token: ['${{ secrets.TEST_PYPI_TOKEN }}', '${{ secrets.PYPI_TOKEN }}']

steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure the full repository is checked out

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -25,20 +26,22 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine
python -m pip install --upgrade pip build twine
- name: Build the package
run: |
python setup.py sdist bdist_wheel
python -m build # Automatically detects `pyproject.toml`
- name: Publish to Test PyPI or PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ matrix.token }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
if [[ "${{ matrix.index-url }}" == "https://upload.pypi.org/legacy/" ]]; then
TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
fi
if [[ "${{ matrix.index-url }}" == "https://upload.pypi.org/legacy/" && "${GITHUB_REF_NAME}" == *-dev* ]]; then
echo "Skipping publish to PyPI for dev version."
exit 0
fi
twine upload --repository-url ${{ matrix.index-url }} dist/*

0 comments on commit e917c09

Please sign in to comment.