Skip to content
Snippets Groups Projects
Commit fc4c30d6 authored by Chris Burr's avatar Chris Burr
Browse files

Upload releases to PyPI automatically

parent 03c160ed
No related branches found
No related tags found
No related merge requests found
......@@ -531,6 +531,7 @@ make_tag:
- mv releases.cfg src/LHCbDIRAC/releases.cfg
- export SERIES=`cat series.txt`
- export VERSION=`cat version.txt`
- export VERSION_PY3=`cat versionPy3.txt`
# insert new release notes into the changelog
- cat ../notes.txt CHANGELOG/$SERIES > newNotes.txt
- mv newNotes.txt CHANGELOG/$SERIES
......@@ -543,6 +544,7 @@ make_tag:
- git commit -av -m "Update versions and changelog for release of ${VERSION}"
# tag current branch
- git tag -a ${VERSION} -m ${VERSION}
- git tag -a ${VERSION_PY3} -m ${VERSION_PY3}
# push commits and tag to main repo back
- git push --tags origin ${CI_COMMIT_REF_NAME}
# If we just tagged master we need to update also the releases.cfg and CHANGELOG in devel
......@@ -576,3 +578,20 @@ MR_SWEEP:
after_script: []
script:
- python /sweep_MR.py -p ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} -b origin/${CI_COMMIT_REF_NAME} -t ${SWEEP_TOKEN} -s "${SWEEP_SINCE}" -u "${SWEEP_UNTIL}" --repository-root ${PWD}
deploy-to-pypi:
stage: deploy_release
# TODO: Remove after this is proven to work
allow_failure: true
only:
- tags@lhcb-dirac/LHCbDIRAC
except:
- /^v[0-9]+r[0-9]+.+$/
image: registry.cern.ch/docker.io/-/python:3.9
before_script:
- pip install twine wheel setuptools-scm[toml]
script:
- python setup.py sdist
- python setup.py bdist_wheel
- if [ -z "$TWINE_PASSWORD" ] ; then echo "Set TWINE_PASSWORD in CI variables" ; exit 1 ; fi
- twine upload -u __token__ dist/*
......@@ -59,6 +59,7 @@ NEXT_RELEASE = os.environ.get('NEXT_RELEASE')
# If the user did not specify a release increment the current version by 1
version = None
versionString = None
versionStringPy3 = None
preRelease = None
if not NEXT_RELEASE:
version = parseVersion(LATEST_RELEASE)
......@@ -66,14 +67,16 @@ if not NEXT_RELEASE:
# Increment patch version for 1
version = (version[0], version[1], version[2] + 1, version[3])
versionString = "v%sr%sp%s" % (version[0], version[1], version[2])
versionStringPy3 = "v%s.%s.%s" % (version[0], version[1], version[2])
preRelease = False
print("Actomatically increment current release %s to %s" % (LATEST_RELEASE, versionString))
print("Automatically increment current release %s to %s" % (LATEST_RELEASE, versionString))
else:
# Increment pre version for 1
version = (version[0], version[1], version[2], version[3] + 1)
versionString = "v%sr%s-pre%s" % (version[0], version[1], version[3])
versionStringPy3 = "v%s.%s.0a%s" % (version[0], version[1], version[3])
preRelease = True
print("Actomatically increment current release %s to %s" % (LATEST_RELEASE, versionString))
print("Automatically increment current release %s to %s" % (LATEST_RELEASE, versionString))
else:
# Use the version specified by NEXT_RELEASE
version = parseVersion(NEXT_RELEASE)
......@@ -103,6 +106,9 @@ linePrepend("../notes.txt", versionString)
# store into artifact the version and series for later usage in tagging process
with open('version.txt', 'a') as fver:
fver.write(versionString)
if versionStringPy3:
with open('versionPy3.txt', 'a') as fver:
fver.write(versionStringPy3)
with open('series.txt', 'a') as fser:
fser.write("v%sr%s" % (version[0], version[1]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment