From b0fe4daef73e9ba9390c825cdd2a9eb8f6be7c88 Mon Sep 17 00:00:00 2001 From: Alexander van der Grinten Date: Sun, 19 Jun 2022 11:40:32 +0200 Subject: [PATCH] github: Add CI/deployment workflow --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..86a9feb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + name: Build source package + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Building using setuptools + run: | + ./setup.py sdist + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: packages + path: dist/xbstrap-*.tar.gz + + deploy: + name: Publish release + runs-on: ubuntu-20.04 + if: "startsWith(github.ref, 'refs/tags/v')" + needs: build + steps: + - name: Fetch artifact + uses: actions/download-artifact@v2 + with: + name: packages + path: artifact + - name: Prepare dist/ directory + run: | + mkdir dist/ + # Get exactly the version that we want to publish. + version="$(grep -Po '(?<=^refs/tags/v).+$' <<< "$ref")" + mv "artifact/xbstrap-$version.tar.gz" dist/ + env: + ref: ${{ github.ref }} + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}