publish-testpypi #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 | |
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt | |
name: "Publish" | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- publish-testpypi | |
- publish-pypi | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
dump_contexts_to_log: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Dump job context | |
env: | |
JOB_CONTEXT: ${{ toJson(job) }} | |
run: echo "$JOB_CONTEXT" | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Dump runner context | |
env: | |
RUNNER_CONTEXT: ${{ toJson(runner) }} | |
run: echo "$RUNNER_CONTEXT" | |
- name: Dump strategy context | |
env: | |
STRATEGY_CONTEXT: ${{ toJson(strategy) }} | |
run: echo "$STRATEGY_CONTEXT" | |
- name: Dump matrix context | |
env: | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} | |
run: echo "$MATRIX_CONTEXT" | |
publish-to-test-pypi: | |
name: "Publish to Test PyPI" | |
if: ${{ github.event.client_payload.event_type == 'publish-testpypi' }} | |
permissions: | |
id-token: write # Needed for trusted publishing to PyPI. | |
runs-on: "ubuntu-latest" | |
environment: | |
name: "testpypi" | |
steps: | |
- name: "Download dists" | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "dist-*" | |
merge-multiple: true | |
path: "dist/" | |
- name: "Publish dists to Test PyPI" | |
uses: pypa/gh-action-pypi-publish@v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
print-hash: true | |
verbose: true | |
publish-to-pypi: | |
name: "Publish to PyPI" | |
if: ${{ github.event.client_payload.event_type == 'publish-pypi' }} | |
permissions: | |
id-token: write # Needed for trusted publishing to PyPI. | |
runs-on: "ubuntu-latest" | |
environment: | |
name: "pypi" | |
steps: | |
- name: "Download dists" | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "dist-*" | |
merge-multiple: true | |
path: "dist/" | |
- name: "Publish dists to PyPI" | |
uses: pypa/gh-action-pypi-publish@v1 | |
with: | |
print-hash: true | |
verbose: true |