Skip to content

Commit

Permalink
Publish to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 26, 2018
1 parent 492eefd commit 1fceeeb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 27 deletions.
17 changes: 14 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,22 @@ dockerBuild {
}
stage('Publish') {
if (abort_ci()) { return }
parallel 'Push to Docker hub': {
withCredentials([string(credentialsId: 'docker-hub', variable: 'DOCKER_PASSWORD')]) {
parallel 'Push to Docker hub and Pypi': {
withCredentials([
string(credentialsId: 'docker-hub', variable: 'DOCKER_PASSWORD'),
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'pypi_sbrunner',
usernameVariable: 'PYPI_USERNAME',
passwordVariable: 'PYPI_PASSWORD',
]
]) {
env.DOCKER_PASSWORD = DOCKER_PASSWORD
env.PYPI_USERNAME = PYPI_USERNAME
env.PYPI_PASSWORD = PYPI_PASSWORD

sshagent (credentials: ['c2c-infra-ci']) {
sh 'travis/publish-docker'
sh 'travis/publish'
}
}
}, 'Push to Transifex': {
Expand Down
61 changes: 37 additions & 24 deletions travis/publish
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,47 @@ then
git push origin ${BRANCH_NAME}
fi

# Get the version to be published
if [ "${TAG}" != "" ]
then
VERSION=${TAG}
elif [ "${BRANCH_NAME}" != "master" ]
then
VERSION=${BRANCH_NAME/\//_}
else
VERSION=${MAJOR_VERSION}
fi
export VERSION

# Publish the GeoMapFish images
for IMAGE in geomapfish-build-dev geomapfish-build
do
if [ "${TAG}" != "" ]
then
docker tag camptocamp/${IMAGE}:${MAJOR_VERSION} camptocamp/${IMAGE}:${TAG}
docker push camptocamp/${IMAGE}:${TAG}
elif [ "${BRANCH_NAME}" != "master" ]
then
docker tag camptocamp/${IMAGE}:${MAJOR_VERSION} camptocamp/${IMAGE}:${BRANCH_NAME/\//_}
docker push camptocamp/${IMAGE}:${BRANCH_NAME/\//_}
else
docker push camptocamp/${IMAGE}:${MAJOR_VERSION}
fi
docker tag camptocamp/${IMAGE}:${MAJOR_VERSION} camptocamp/${IMAGE}:${VERSION}
docker push camptocamp/${IMAGE}:${VERSION}
done

# Publish the GeoMapFish QGIS server images
for QGIS_VERSION in 3.2 master
do
if [ "${TAG}" != "" ]
then
docker tag camptocamp/geomapfish-qgisserver:gmf${MAJOR_VERSION}-qgis${QGIS_VERSION} \
camptocamp/geomapfish-qgisserver:gmf${TAG}-qgis${QGIS_VERSION}
docker push camptocamp/geomapfish-qgisserver:gmf${TAG}-qgis${QGIS_VERSION}
elif [ "${BRANCH_NAME}" != "master" ]
then
docker tag camptocamp/geomapfish-qgisserver:gmf${MAJOR_VERSION}-qgis${QGIS_VERSION} \
camptocamp/geomapfish-qgisserver:gmf${BRANCH_NAME/\//_}-qgis${QGIS_VERSION}
docker push camptocamp/geomapfish-qgisserver:gmf${BRANCH_NAME/\//_}-qgis${QGIS_VERSION}
else
docker push camptocamp/geomapfish-qgisserver:gmf${MAJOR_VERSION}-qgis${QGIS_VERSION}
fi
docker tag camptocamp/geomapfish-qgisserver:gmf${MAJOR_VERSION}-qgis${QGIS_VERSION} \
camptocamp/geomapfish-qgisserver:gmf${VERSION}-qgis${QGIS_VERSION}
docker push camptocamp/geomapfish-qgisserver:gmf${VERSION}-qgis${QGIS_VERSION}
done

# Prepare .pypirc config
echo "[distutils]" > ~/.pypirc
echo "index-servers = pypi" >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "repository:https://upload.pypi.org/legacy/" >> ~/.pypirc
echo "username:${PYPI_USERNAME}" >> ~/.pypirc
echo "password:${PYPI_PASSWORD}" >> ~/.pypirc

# Publish the Python eggs
for PKG in commons geoportal admin
do
./docker-run --home python ${PKG}/setup.py egg_info --no-date sdist bdist_wheel upload -r pypi
done

# Cleanup
rm ~/.pypirc
rm ~/.docker

0 comments on commit 1fceeeb

Please sign in to comment.