From 6dbc8be0d08c8600a54efe567d65ec9b7c5038a1 Mon Sep 17 00:00:00 2001 From: Alexander van der Grinten Date: Mon, 28 Oct 2024 22:50:14 +0100 Subject: [PATCH] workflows: Add deploy job --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c758699..64afd2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,28 @@ jobs: with: name: packages path: dist/y4-*.tar.gz + + deploy: + name: Publish release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/v')" + needs: build + steps: + - name: Fetch artifact + uses: actions/download-artifact@v4 + 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/y4-$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 }}