diff --git a/.travis.yml b/.travis.yml
index 44baae0044a93f0b62ffcafd97477eab17dd8cd6..e7f7503ec4b99c7f6e4b5bb8b58e691c8aef0b88 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -263,3 +263,5 @@ after_success:
   - if test "$MAKEDOC" == yes ; then ./.travis/push doc ; fi 
   - if test "$MAKECOVERAGE" == yes ; then ./.travis/push coverage ; fi 
   - if test "$MAKECOVERAGE" == yes ; then bash <(curl -s https://codecov.io/bash) > /dev/null ; fi
+# upload conda package
+  - if test -n "$PLUMED_CONDA" && test -n "$TRAVIS_TAG" ; then make -C conda upload ; fi
diff --git a/conda/Makefile b/conda/Makefile
index 021565a3f678303b4e4074621079596a9daefc69..5d070a1f61e52d75849b5055847fff31a41b2a19 100644
--- a/conda/Makefile
+++ b/conda/Makefile
@@ -8,6 +8,9 @@ all: build
 build:
 	bash run-conda-build.sh
 
+upload:
+	bash run-conda-upload.sh
+
 
 
 # https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html
diff --git a/conda/run-conda-build.sh b/conda/run-conda-build.sh
index 55de293e899646b9c9e74db3ddf3e57de605a1e2..98a06d34d8e0d8f16314bb9bbd4efbe2ae146b6a 100644
--- a/conda/run-conda-build.sh
+++ b/conda/run-conda-build.sh
@@ -26,24 +26,3 @@ conda-build recipe
 ls -l $CONDA_HOME/conda-bld/
 ls -l $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64
 
-
-# And now upload if desired
-# conda upload $CONDA_HOME/conda-bld/linux-64/*.tar.bz2
-
-# https://gist.github.com/zshaheen/fe76d1507839ed6fbfbccef6b9c13ed9
-
-# https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html
-
-
-# One could play with this, but perhaps best not to spam the channel repository
-export VERSION=`date +%Y.%m.%d`
-
-# Disabled because it fails
-if [[ -n "$CONDA_UPLOAD_TOKEN" ]]; then
-    USER=plumed  # the conda channel
-    anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l testing \
-	     $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64/plumed*.tar.bz2 --force
-fi
-
-
-
diff --git a/conda/run-conda-upload.sh b/conda/run-conda-upload.sh
new file mode 100644
index 0000000000000000000000000000000000000000..03a3a2340e419b293fbf851a37a00337f684a685
--- /dev/null
+++ b/conda/run-conda-upload.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Anywhere but outside of the repository
+export CONDA_HOME=/var/tmp/miniconda
+
+if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+    csys=Linux
+elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+    csys=MacOSX
+else
+    echo "Unsupported system $TRAVIS_OS_NAME"
+    exit 1
+fi
+    
+export PATH="$CONDA_HOME/bin:$PATH"
+export VERSION=$TRAVIS_TAG
+
+# Disabled because it fails
+if [[ -n "$CONDA_UPLOAD_TOKEN" ]]; then
+    USER=plumed  # the conda channel
+    anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l testing \
+	     $CONDA_HOME/conda-bld/$TRAVIS_OS_NAME-64/plumed*.tar.bz2 --force
+fi
+
+
+