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: ...@@ -16,9 +16,11 @@ jobs:
displayName: Configure Python version displayName: Configure Python version
- script: | - script: |
echo $(build_type)
echo $(NNI_RELEASE)
export BRANCH_TAG=`git describe --tags --abbrev=0` export BRANCH_TAG=`git describe --tags --abbrev=0`
echo $BRANCH_TAG 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' echo 'Build version match branch tag'
else else
echo 'Build version does not match branch tag' echo 'Build version does not match branch tag'
...@@ -28,15 +30,16 @@ jobs: ...@@ -28,15 +30,16 @@ jobs:
displayName: Validate release version number and branch tag displayName: Validate release version number and branch tag
- script: | - script: |
echo $(build_type)
echo $(NNI_RELEASE) 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 'Valid prerelease version $(NNI_RELEASE)'
echo `git describe --tags --abbrev=0` echo `git describe --tags --abbrev=0`
else else
echo 'Invalid build version $(NNI_RELEASE)' echo 'Invalid build version $(NNI_RELEASE)'
exit 1 exit 1
fi fi
condition: ne( variables['build_type'], 'rerelease' ) condition: ne( variables['build_type'], 'release' )
displayName: Validate prerelease version number displayName: Validate prerelease version number
- job: linux - job: linux
...@@ -57,17 +60,17 @@ jobs: ...@@ -57,17 +60,17 @@ jobs:
displayName: Build wheel displayName: Build wheel
- script: | - script: |
if [ $(build_type) = 'release' ]; then if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo 'uploading release package to pypi...' echo 'uploading to pypi...'
python -m twine upload -u nni -p $(pypi_password) dist/* python -m twine upload -u nni -p $(pypi_password) dist/*
else 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/* python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
fi fi
displayName: Upload wheel displayName: Upload wheel
- script: | - script: |
if [ $(build_type) = 'release' ]; then if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
docker login -u msranni -p $(docker_hub_password) docker login -u msranni -p $(docker_hub_password)
export IMAGE_NAME=msranni/nni export IMAGE_NAME=msranni/nni
else else
...@@ -78,8 +81,10 @@ jobs: ...@@ -78,8 +81,10 @@ jobs:
echo "## Building ${IMAGE_NAME}:$(NNI_RELEASE) ##" echo "## Building ${IMAGE_NAME}:$(NNI_RELEASE) ##"
docker build --build-arg NNI_RELEASE=$(NNI_RELEASE) -t ${IMAGE_NAME} . docker build --build-arg NNI_RELEASE=$(NNI_RELEASE) -t ${IMAGE_NAME} .
docker tag ${IMAGE_NAME} ${IMAGE_NAME}:$(NNI_RELEASE) docker tag ${IMAGE_NAME} ${IMAGE_NAME}:$(NNI_RELEASE)
docker push ${IMAGE_NAME}
docker push ${IMAGE_NAME}:$(NNI_RELEASE) docker push ${IMAGE_NAME}:$(NNI_RELEASE)
if [[ $(build_type) != 'rc' ]]; then
docker push ${IMAGE_NAME}
fi
displayName: Build and upload docker image displayName: Build and upload docker image
- job: macos - job: macos
...@@ -100,7 +105,7 @@ jobs: ...@@ -100,7 +105,7 @@ jobs:
displayName: Build wheel displayName: Build wheel
- script: | - script: |
if [ $(build_type) = 'release' ]; then if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo '## uploading to pypi ##' echo '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/* python -m twine upload -u nni -p $(pypi_password) dist/*
else else
...@@ -127,11 +132,10 @@ jobs: ...@@ -127,11 +132,10 @@ jobs:
displayName: Build wheel displayName: Build wheel
- powershell: | - powershell: |
if($env:BUILD_TYPE -eq 'release'){ if ($env:BUILD_TYPE -eq 'release' -Or $env:BUILD_TYPE -eq 'rc') {
Write-Host '## uploading to pypi ##' Write-Host '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/* python -m twine upload -u nni -p $(pypi_password) dist/*
} } else {
else{
Write-Host '## uploading to testpypi ##' Write-Host '## uploading to testpypi ##'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/* 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