From 1a98df593563b3bb46a00b06936df969e1eedde9 Mon Sep 17 00:00:00 2001 From: GeorgWa Date: Tue, 10 Sep 2024 11:47:08 +0200 Subject: [PATCH] add action --- .github/workflows/publish_on_pypi.yml | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/publish_on_pypi.yml diff --git a/.github/workflows/publish_on_pypi.yml b/.github/workflows/publish_on_pypi.yml new file mode 100644 index 0000000..8c475a1 --- /dev/null +++ b/.github/workflows/publish_on_pypi.yml @@ -0,0 +1,51 @@ +on: + workflow_dispatch: + +name: Publish on PyPi + +env: + PYTHON_VERSION: "3.9" + +jobs: + Create_PyPi_Release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + auto-update-conda: true + python-version: ${{ env.PYTHON_VERSION }} + - name: Conda info + shell: bash -le {0} + run: conda info + - name: Prepare distribution + shell: bash -le {0} + run: | + conda create -n pylmd_build python=${{ env.PYTHON_VERSION }} -y + conda activate pylmd_build + python -m pip install --upgrade pip + pip install build twine + rm -rf dist + rm -rf build + python -m build + twine check dist/* + conda deactivate + conda env remove --name pylmd_build -y + conda clean --all -y + - name: Publish distribution to Test-PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + - name: Test Test-PyPI loose installation + shell: bash -le {0} + run: | + conda create -n pip_loose_test python=${{ env.PYTHON_VERSION }} -y + conda activate pip_loose_test + pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "py-lmd" + alphadia -v + conda deactivate + conda env remove --name pip_stable_test -y + conda clean --all -y \ No newline at end of file