Skip to content

Commit

Permalink
Fix publish.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
bindreams committed Apr 28, 2024
1 parent 3b84361 commit 1e4ddfa
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# See also:
# https://github.com/pypa/gh-action-pypi-publish
# https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/
name: Publish

on:
Expand All @@ -13,28 +16,24 @@ on:
types: [published]

jobs:
build:
name: Build distribution files
uses: ./.github/workflows/build.yaml

publish:
name: Publish to ${{ options.repository }}
name: Publish to ${{ inputs.repository }}
needs: [build]
runs-on: ubuntu-latest
environment:
name: publish-${{ inputs.repository }}
url: ${{ vars.ENVIRONMENT_URL }}
permissions:
id-token: write
steps:
- uses: ./.github/workflows/build.yaml
- uses: actions/download-artifact@v4
with:
pattern: package-*
path: dist
merge-multiple: true

- name: Determine upload URL
run: |
case "${{ inputs.repository }}" in
"TestPyPI") URL="https://test.pypi.org/legacy/";;
"PyPI") URL="https://upload.pypi.org/legacy/";;
*) echo "Incorrect input"; exit 1;;
esac
echo "UPLOAD_URL=$URL" >> "$GITHUB_ENV"
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: $UPLOAD_URL

0 comments on commit 1e4ddfa

Please sign in to comment.