Skip to content

Commit

Permalink
CI: Improve the wheel building workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BvB93 committed Apr 4, 2023
1 parent 5f8f4f9 commit 2782821
Showing 1 changed file with 50 additions and 31 deletions.
81 changes: 50 additions & 31 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,55 @@
name: Publish

on:
release:
types: [published, edited]
release:
types: [published]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: pip install build

- name: Python info
run: |
which python
python --version
- name: Installed packages
run: pip list

- name: Build the package
run: python -m build --sdist --wheel

- name: Publish the package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: pip install build twine

- name: Python info
run: |
which python
python --version
- name: Installed packages
run: pip list

- name: Build the package
run: python -m build --sdist --wheel

- name: Validate wheels
run: |
tree dist
twine check dist/*
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./build/*

- name: Publish the package
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Attach wheels to GitHub release
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v2.0.2
with:
files: 'dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2782821

Please sign in to comment.