Update release CI #6
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
name: Publish to PyPI.org | |
on: | |
push: | |
branches: | |
- main | |
- master | |
release: | |
types: | |
- published | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python3 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Build sdist | |
run: | | |
pipx run build --sdist ${{github.workspace}}/ament_black/ | |
mkdir -p dist && mv ${{github.workspace}}/ament_black/dist/*.tar.gz dist/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
build_wheel: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python3 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Build wheel | |
run: pipx run build --wheel ${{github.workspace}}/ament_black/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
pypi: | |
if: github.event_name == 'release' | |
needs: [build_wheel, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |