From 86c36e50af86aa3f34c21f366255e3dd52678d6c Mon Sep 17 00:00:00 2001 From: DavidHerreros Date: Fri, 12 Jul 2024 16:28:01 +0200 Subject: [PATCH] Publish to Pypi and version tag workflow --- .github/workflows/publish_and_tag.yml | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/publish_and_tag.yml diff --git a/.github/workflows/publish_and_tag.yml b/.github/workflows/publish_and_tag.yml new file mode 100644 index 0000000..78ae8f6 --- /dev/null +++ b/.github/workflows/publish_and_tag.yml @@ -0,0 +1,46 @@ +# Workflow to send master to pypi and tag the branch: +# You need to edit FOLDER_WITH_VERSION with the folder that has the __version__ value. + +name: main to pypi with comments and tag + + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ main ] + +env: + FOLDER_WITH_VERSION: cryo_challenge +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up MPI + uses: mpi4py/setup-mpi@v1 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + pip install scipion-pyworkflow + pip install scipion-em + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* -c "${{ secrets.PYPI_COMMENT }}" + - name: Get version and tag + run: | + export PACKAGE_VERSION=$(python -c "import $FOLDER_WITH_VERSION; print('v'+$FOLDER_WITH_VERSION.__version__);"| tail -n 1) + git tag $PACKAGE_VERSION + git push origin $PACKAGE_VERSION \ No newline at end of file