Add source distribution and upload jobs (#2203)

This commit is contained in:
Cuong Duong 2022-06-25 06:55:02 +10:00 committed by GitHub
parent 94fbe79f44
commit 135dbf8777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,8 @@
name: "Create Python Wheels"
name: "Create Python distributions and upload to PyPI"
on:
release:
types: [ created ]
types: [ published ]
workflow_dispatch: {}
@ -11,7 +11,7 @@ env:
jobs:
make-wheels:
name: ${{ matrix.os }}
name: Make ${{ matrix.os }} wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
@ -46,7 +46,43 @@ jobs:
CIBW_TEST_COMMAND: pytest --pyargs prophet
- name: "Upload wheel as artifact"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-wheel
name: artifact-${{ matrix.os }}-wheel
path: "./**/*.whl"
make-sdist:
name: Make source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx run build --sdist
working-directory: python
- uses: actions/upload-artifact@v3
with:
name: artifact-source-dist
path: "./**/dist/*.tar.gz"
upload:
name: Upload to PyPI
needs: [make-wheels, make-sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Copy artifacts to dist/ folder
run: |
find . -name 'artifact-*' -exec unzip '{}' \;
mkdir -p dist/
find . -name '*.tar.gz' -exec mv '{}' dist/ \;
find . -name '*.whl' -exec mv '{}' dist/ \;
- name: Upload
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}