Unverified Commit d1e94573 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Update release pipeline to support rc (#3278)

parent 6e5584a8
......@@ -16,9 +16,11 @@ jobs:
displayName: Configure Python version
- script: |
echo $(build_type)
echo $(NNI_RELEASE)
export BRANCH_TAG=`git describe --tags --abbrev=0`
echo $BRANCH_TAG
if [[ $BRANCH_TAG = v$(NNI_RELEASE) && $(NNI_RELEASE) =~ ^v[0-9](.[0-9])+$ ]]; then
if [[ $BRANCH_TAG == v$(NNI_RELEASE) && $(NNI_RELEASE) =~ ^v[0-9](.[0-9])+$ ]]; then
echo 'Build version match branch tag'
else
echo 'Build version does not match branch tag'
......@@ -28,15 +30,16 @@ jobs:
displayName: Validate release version number and branch tag
- script: |
echo $(build_type)
echo $(NNI_RELEASE)
if [[ $(NNI_RELEASE) =~ ^[0-9](.[0-9])+a[0-9]$ ]]; then
if [[ $(NNI_RELEASE) =~ ^[0-9](.[0-9])+(a|b|rc)[0-9]$ ]]; then
echo 'Valid prerelease version $(NNI_RELEASE)'
echo `git describe --tags --abbrev=0`
else
echo 'Invalid build version $(NNI_RELEASE)'
exit 1
fi
condition: ne( variables['build_type'], 'rerelease' )
condition: ne( variables['build_type'], 'release' )
displayName: Validate prerelease version number
- job: linux
......@@ -57,17 +60,17 @@ jobs:
displayName: Build wheel
- script: |
if [ $(build_type) = 'release' ]; then
echo 'uploading release package to pypi...'
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo 'uploading to pypi...'
python -m twine upload -u nni -p $(pypi_password) dist/*
else
echo 'uploading prerelease package to testpypi...'
echo 'uploading to testpypi...'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
fi
displayName: Upload wheel
- script: |
if [ $(build_type) = 'release' ]; then
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
docker login -u msranni -p $(docker_hub_password)
export IMAGE_NAME=msranni/nni
else
......@@ -78,8 +81,10 @@ jobs:
echo "## Building ${IMAGE_NAME}:$(NNI_RELEASE) ##"
docker build --build-arg NNI_RELEASE=$(NNI_RELEASE) -t ${IMAGE_NAME} .
docker tag ${IMAGE_NAME} ${IMAGE_NAME}:$(NNI_RELEASE)
docker push ${IMAGE_NAME}
docker push ${IMAGE_NAME}:$(NNI_RELEASE)
if [[ $(build_type) != 'rc' ]]; then
docker push ${IMAGE_NAME}
fi
displayName: Build and upload docker image
- job: macos
......@@ -100,7 +105,7 @@ jobs:
displayName: Build wheel
- script: |
if [ $(build_type) = 'release' ]; then
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/*
else
......@@ -127,11 +132,10 @@ jobs:
displayName: Build wheel
- powershell: |
if($env:BUILD_TYPE -eq 'release'){
if ($env:BUILD_TYPE -eq 'release' -Or $env:BUILD_TYPE -eq 'rc') {
Write-Host '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/*
}
else{
} else {
Write-Host '## uploading to testpypi ##'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment