Skip to content

Commit

Permalink
Upload binaries to existing release if they were not uploaded jl777#589
Browse files Browse the repository at this point in the history
… (jl777#594)

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Call Github release API via curl to check that assets are uploaded.

* Log DEBUG_UPLOADED and RELEASE_UPLOADED.

* Use COMMIT_TAG from env to determine DEBUG_UPLOADED and RELEASE_UPLOADED.

* Use TAG from env to determine DEBUG_UPLOADED and RELEASE_UPLOADED.

* Build and publish to Github only when corresponding binaries are not uploaded.

* Fix bash if on Setup ENV.

* Check the git tag instead of hard code.

* Clean upload dir -> Recreate upload dir.

* If commit is tagged edit existing release, create new release if there's no tag.

* Always echo DEBUG_UPLOADED, RELEASE_UPLOADED and RELEASE_TAG.

* Try to fix RELEASE_TAG when commit is not tagged.

* echo $(Build.BuildId)

* Echo if commit tag is empty.

* Use [ -z $TAG ] to determine if $TAG is empty.

* Enable the Build and test Debug stage back.

* Release only on mm2 branch again.
  • Loading branch information
artemii235 authored Mar 3, 2020
1 parent c82f84d commit afd2148
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions azure-pipelines-release-stage-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,59 +21,74 @@ 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
displayName: Build Windows deps
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
cat MM_VERSION
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
Expand All @@ -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'], '' ) )

0 comments on commit afd2148

Please sign in to comment.