From a151e09fe435870a2929191f5db99db5e1d6396e Mon Sep 17 00:00:00 2001 From: mariugul Date: Fri, 23 Aug 2024 00:47:59 +0200 Subject: [PATCH] ci: publish dispatch workflow --- .github/workflows/publish.yml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c2da0df --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Python Package Dispatch + +on: + workflow_dispatch: # Allows manual triggering of the workflow + +jobs: + build-and-publish: + runs-on: ubuntu-latest + env: + POETRY_HOME: /opt/poetry + VENV_PATH: venv + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Cache Python dependencies + id: cache-python-deps + uses: actions/cache@v3 + with: + path: ${{ env.VENV_PATH }} + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + venv-${{ runner.os }}- + + - name: Install Poetry + if: steps.cache-python-deps.outputs.cache-hit != 'true' + run: | + python3 -m venv $POETRY_HOME + ${{ env.VENV_PATH }}/bin/pip install poetry==1.8.2 + ${{ env.VENV_PATH }}/bin/poetry --version + + - name: Install Package + run: | + ${{ env.VENV_PATH }}/bin/poetry install + + - name: Build Package + run: | + ${{ env.VENV_PATH }}/bin/poetry build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1