diff --git a/azure-pipelines-release-stage-job.yml b/azure-pipelines-release-stage-job.yml index 8609402e9a..1f748ad368 100644 --- a/azure-pipelines-release-stage-job.yml +++ b/azure-pipelines-release-stage-job.yml @@ -21,6 +21,20 @@ jobs: echo "##vso[task.setvariable variable=COMMIT_HASH]${SHORT_HASH}" export TAG="$(git tag -l --points-at HEAD)" echo "##vso[task.setvariable variable=COMMIT_TAG]${TAG}" + if [ -z $TAG ]; then + echo "Commit tag is empty" + export RELEASE_TAG=beta-2.0.$(Build.BuildId) + else + export DEBUG_UPLOADED="$(curl -s https://api.github.com/repos/KomodoPlatform/atomicDEX-API/releases/tags/$TAG | grep $(Agent.OS)-Debug)" + export RELEASE_UPLOADED="$(curl -s https://api.github.com/repos/KomodoPlatform/atomicDEX-API/releases/tags/$TAG | grep $(Agent.OS)-Release)" + export RELEASE_TAG=$TAG + fi + echo DEBUG_UPLOADED:$DEBUG_UPLOADED + echo RELEASE_UPLOADED:$RELEASE_UPLOADED + echo RELEASE_TAG:$RELEASE_TAG + echo "##vso[task.setvariable variable=DEBUG_UPLOADED]${DEBUG_UPLOADED}" + echo "##vso[task.setvariable variable=RELEASE_UPLOADED]${RELEASE_UPLOADED}" + echo "##vso[task.setvariable variable=RELEASE_TAG]${RELEASE_TAG}" displayName: Setup ENV - powershell: | .\marketmaker_build_depends.cmd @@ -28,27 +42,28 @@ jobs: condition: and( eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['COMMIT_TAG'], '' ) ) - bash: | rm -rf upload - displayName: 'Clean upload dir' - - bash: | mkdir upload + displayName: 'Recreate upload dir' + - bash: | echo 2.0.$(Build.BuildId)_$(Build.SourceBranchName)_$(COMMIT_HASH)_$(Agent.OS)_Debug > MM_VERSION cat MM_VERSION touch mm2src/common/build.rs cargo build --features native -vv displayName: 'Build MM2 Debug' + condition: eq( variables['DEBUG_UPLOADED'], '' ) - bash: | zip upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Debug target/debug/mm2 -j displayName: 'Prepare debug build upload Linux' - condition: eq( variables['Agent.OS'], 'Linux' ) + condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['DEBUG_UPLOADED'], '' ) ) - bash: | cd target/debug zip ../../upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Debug mm2.dSYM mm2 -r displayName: 'Prepare debug build upload MacOS' - condition: eq( variables['Agent.OS'], 'Darwin' ) + condition: and( eq( variables['Agent.OS'], 'Darwin' ), eq( variables['DEBUG_UPLOADED'], '' ) ) - powershell: | 7z a .\upload\mm2-$(COMMIT_HASH)-$(Agent.OS)-Debug.zip .\target\debug\mm2.exe .\target\debug\*.dll "$Env:windir\system32\msvcr100.dll" "$Env:windir\system32\msvcp140.dll" "$Env:windir\system32\vcruntime140.dll" displayName: 'Prepare debug build upload Windows' - condition: eq( variables['Agent.OS'], 'Windows_NT' ) + condition: and( eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['DEBUG_UPLOADED'], '' ) ) - bash: | rm -f MM_VERSION echo 2.0.$(Build.BuildId)_$(Build.SourceBranchName)_$(COMMIT_HASH)_$(Agent.OS)_Release > MM_VERSION @@ -56,24 +71,24 @@ jobs: touch mm2src/common/build.rs cargo build --features native --release -vv displayName: 'Build MM2 Release' - condition: eq( variables['COMMIT_TAG'], '' ) + condition: eq( variables['RELEASE_UPLOADED'], '' ) - bash: | objcopy --only-keep-debug target/release/mm2 target/release/mm2.debug strip -g target/release/mm2 zip upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Release target/release/mm2 -j zip upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Release-debuginfo.zip target/release/mm2.debug -j displayName: 'Prepare release build upload Linux' - condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['COMMIT_TAG'], '' ) ) + condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['RELEASE_UPLOADED'], '' ) ) - bash: | cd target/release zip ../../upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Release.zip mm2 zip ../../upload/mm2-$(COMMIT_HASH)-$(Agent.OS)-Release.dSYM.zip mm2.dSYM -r displayName: 'Prepare release build upload MacOS' - condition: and( eq( variables['Agent.OS'], 'Darwin' ), eq( variables['COMMIT_TAG'], '' ) ) + condition: and( eq( variables['Agent.OS'], 'Darwin' ), eq( variables['RELEASE_UPLOADED'], '' ) ) - powershell: | 7z a .\upload\mm2-$(COMMIT_HASH)-$(Agent.OS)-Release.zip .\target\release\mm2.exe .\target\release\*.dll "$Env:windir\system32\msvcr100.dll" "$Env:windir\system32\msvcp140.dll" "$Env:windir\system32\vcruntime140.dll" displayName: 'Prepare release build upload Windows' - condition: and( eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['COMMIT_TAG'], '' ) ) + condition: and( eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['RELEASE_UPLOADED'], '' ) ) - task: GitHubRelease@0 inputs: action: edit @@ -82,5 +97,5 @@ jobs: assets: 'upload/*' assetUploadMode: replace tagSource: manual - tag: beta-2.0.$(Build.BuildId) - condition: eq( variables['COMMIT_TAG'], '' ) + tag: $(RELEASE_TAG) + condition: or( eq( variables['RELEASE_UPLOADED'], '' ), eq( variables['DEBUG_UPLOADED'], '' ) )