Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/reusable-python-download_dist_release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Download Python distribution files (GitHub release)
description: >
Download built distribution files from a GitHub release into a local
"dist-download" directory, ready to be published.
inputs:
release-tag:
description: Tag of the GitHub release to download assets from
required: true
type: string
github-token:
description: Token used to download release assets via "gh release download"
required: true
type: string

runs:
using: composite
steps:
- name: Download release assets
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
GH_REPO: ${{ github.repository }}
INPUTS_RELEASE_TAG: ${{ inputs.release-tag }}
run: |
mkdir -p dist-download
cd dist-download
gh release download "${INPUTS_RELEASE_TAG}" -p '*.tar.gz' -p '*.whl'
19 changes: 10 additions & 9 deletions .github/workflows/reusable-python-publish_pypi_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ on:
type: boolean
default: true
virtual-repo-names:
description: 'List of virtual repository names to publish to (e.g. ["public-pypi-dev", "geophysics-pypi-dev"])'
description: >
List of virtual repository names to publish to (e.g. ["public-pypi-dev", "geophysics-pypi-dev"]).
"pypi"/"test-pypi" are a deliberate no-op here; PyPI publishing runs in the caller.
required: true
type: string
os:
Expand Down Expand Up @@ -139,14 +141,13 @@ jobs:
artifactory-dir-path: ${{ matrix.virtual-repo-name }}/${{ inputs.package-name }}/${{ env.version }}
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
- name: Publish package to PyPI
if: ${{ matrix.virtual-repo-name == 'pypi' || matrix.virtual-repo-name == 'test-pypi'}}
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
with:
verbose: true
packages-dir: ${{ env.build-dir-path }}/
repository-url: https://${{ matrix.virtual-repo-name == 'test-pypi' && 'test.pypi' || 'upload.pypi'}}.org/legacy/
password: ${{ secrets.PYPI_TOKEN }}
- name: Fail on PyPI/TestPyPI virtual-repo-name
if: ${{ matrix.virtual-repo-name == 'pypi' || matrix.virtual-repo-name == 'test-pypi' }}
env:
VIRTUAL_REPO_NAME: ${{ matrix.virtual-repo-name }}
run: |
echo "::error::Not publishing '${VIRTUAL_REPO_NAME}' here: PyPI trusted publishing must run as a direct step in the caller's top-level workflow, not through this reusable workflow. See the 'virtual-repo-names' input description."
exit 1

add_release_asset:
name: Add release asset
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/reusable-python-release_pypi_assets.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: same comments as in the other workflow apply here

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
type: string
virtual-repo-names:
description: >
List of repository names to publish to
(e.g. ["public-pypi-prod", "geophysics-pypi-prod"])
List of repository names to publish to (e.g. ["public-pypi-prod", "geophysics-pypi-prod"]).
"pypi"/"test-pypi" are a deliberate no-op here; PyPI publishing runs in the caller (DEVOPS-1154).
required: true
type: string
release-tag:
Expand Down Expand Up @@ -69,11 +69,10 @@ jobs:
artifactory-dir-path: ${{ matrix.virtual-repo-name }}/${{ inputs.package-name }}/${{ inputs.release-tag }}
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
- name: Publish package to PyPI
if: ${{ matrix.virtual-repo-name == 'pypi' || matrix.virtual-repo-name == 'test-pypi'}}
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
with:
verbose: true
packages-dir: download-assets/
repository-url: https://${{ matrix.virtual-repo-name == 'test-pypi' && 'test.pypi' || 'upload.pypi'}}.org/legacy/
password: ${{ secrets.PYPI_TOKEN }}
- name: Fail on PyPI/TestPyPI virtual-repo-name
if: ${{ matrix.virtual-repo-name == 'pypi' || matrix.virtual-repo-name == 'test-pypi' }}
env:
VIRTUAL_REPO_NAME: ${{ matrix.virtual-repo-name }}
run: |
echo "::error::Not publishing '${VIRTUAL_REPO_NAME}' here: PyPI trusted publishing must run as a direct step in the caller's top-level workflow, not through this reusable workflow. See the 'virtual-repo-names' input description."
exit 1
Loading