Skip to content

Commit

Permalink
Don't publish in reusable workflow
Browse files Browse the repository at this point in the history
Reusable workflows cannot currently be used as the workflow in a trusted
publisher. See:

https://docs.pypi.org/trusted-publishers/troubleshooting/
pypi/warehouse#11096
  • Loading branch information
soininen committed Mar 28, 2024
1 parent 6e5e17f commit bb3ebda
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/test-n-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install pytest
- name: Install pytest and built wheels on *NIX
- name: Built wheels on *NIX
if: ${{ inputs[matrix.pkg] != 'skip' && runner.os != 'Windows' }}
run: |
ls dist
python -m pip install dist/*/*.whl
- name: Install pytest and built wheels on Windows
- name: Built wheels on Windows
if: ${{ inputs[matrix.pkg] != 'skip' && runner.os == 'Windows' }}
run: |
Get-ChildItem ./dist/*.whl -Recurse | ForEach-Object {python -m pip install $_}
Expand Down Expand Up @@ -145,12 +145,35 @@ jobs:
python -m unittest discover -s ${{ matrix.pkg }} --pattern execution_test.py --verbose
publish:
# isolate from test, to prevent partial uploads
needs: test
strategy:
matrix:
pkg: ['Spine-Database-API', 'spine-engine', 'spine-items', 'Spine-Toolbox']
uses: ./.github/workflows/publish-wheel.yml
with:
pkg: ${{ matrix.pkg }}
ver: ${{ inputs[matrix.pkg] }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ steps.package_name.outputs.name }}
permissions:
id-token: write
steps:
- name: Make dist directory
if: ${{ inputs[matrix.pkg] != 'skip' }}
run: mkdir -p dist
- name: Download package wheel
if: ${{ inputs[matrix.pkg] != 'skip' }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.pkg }}
path: dist
- id: package_name
if: ${{ inputs[matrix.pkg] != 'skip' }}
run: |
echo name=$(ls dist | awk -F'[-]' '{print $1}') >> $GITHUB_OUTPUT
- name: Publish to PyPI using trusted publishing
if: ${{ inputs[matrix.pkg] != 'skip' }}
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
# packages-dir: dist/
# skip-existing: true
# verify-metadata: false

0 comments on commit bb3ebda

Please sign in to comment.