From 74182af217554c632c5813be72bcf95d14d23c37 Mon Sep 17 00:00:00 2001 From: Fabien LOISON Date: Wed, 1 Dec 2021 13:20:44 +0100 Subject: [PATCH] Add Github Actions workflow to build and publish sdist and wheel to PyPI --- .github/workflows/python-packages.yml | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/python-packages.yml diff --git a/.github/workflows/python-packages.yml b/.github/workflows/python-packages.yml new file mode 100644 index 00000000..1e2089b3 --- /dev/null +++ b/.github/workflows/python-packages.yml @@ -0,0 +1,63 @@ +name: "Build and Publish Python Packages" + +on: + push: + tags: "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + + build_sdist_wheel: + + name: "Source and wheel distribution" + runs-on: ubuntu-latest + + steps: + + - name: "Checkout the repository" + uses: actions/checkout@v2 + + - name: "Set up Python" + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: "Install Python build dependencies" + run: | + pip install wheel nox + + - name: "Build source distribution" + run: | + python setup.py sdist + + - name: "Build wheel" + run: | + python setup.py bdist_wheel + + - name: "Upload artifacts" + uses: actions/upload-artifact@v2 + with: + name: rivalcfg-dist + path: dist/ + retention-days: 1 + + publish_pypi: + + name: "Publish packages on PyPI" + runs-on: ubuntu-latest + needs: + - build_sdist_wheel + + steps: + + - name: "Download artifacts" + uses: actions/download-artifact@v2 + + - name: "Move packages to the dist/ folder" + run: | + mkdir dist/ + mv rivalcfg-dist/* dist/ + + - name: "Publish packages on PyPI" + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}