Skip to content

Commit

Permalink
De-dup building
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jan 27, 2023
1 parent 2e692da commit 3e05709
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions .github/workflows/pypi-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ permissions:
contents: read

jobs:
release-test-pypi:
# Upload to Test PyPI on every commit & pushed tag.
environment: release-test-pypi
build-package:
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
- uses: step-security/harden-runner@v2
with:
egress-policy: block
# Need the real pypi.org for installations.
Expand All @@ -36,6 +32,23 @@ jobs:

- uses: hynek/build-and-inspect-python-package@v1

release-test-pypi:
# Upload to Test PyPI on every commit & pushed tag.
environment: release-test-pypi
runs-on: ubuntu-latest
needs: build-package

steps:
- uses: step-security/harden-runner@v2
with:
egress-policy: block
# Need the real pypi.org for installations.
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
test.pypi.org:443
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v3
with:
Expand All @@ -53,10 +66,10 @@ jobs:
environment: release-pypi
if: github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
- uses: step-security/harden-runner@v2
with:
egress-policy: block
allowed-endpoints: >
Expand All @@ -65,15 +78,11 @@ jobs:
pypi.org:443
upload.pypi.org:443
- uses: actions/checkout@v3
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v3
with:
fetch-depth: 0

- name: Build package
run: |
python -m pip install -U build twine wheel
python -m build
twine check --strict dist/*
name: Packages
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down

0 comments on commit 3e05709

Please sign in to comment.