-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
34 lines (32 loc) · 1.54 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
debug_build:
stage: build
script:
- pwd
- 'msbuild -t:build /p:Configuration=MQ2DotNet-Debug -restore -p:RestorePackagesPath=build/Debug/packages'
artifacts:
paths:
- build/Debug/MQ2DotNet
only:
- develop
release_build:
stage: build
script:
- 'msbuild -t:build /p:Configuration=MQ2DotNet-Release -restore -p:RestorePackagesPath=build/Release/packages'
artifacts:
paths:
- build/Release/MQ2DotNet
only:
- tags
release_deploy:
stage: deploy
script:
- 'Compress-Archive -Path build/Release/MQ2DotNet/MQ2DotNet.dll, build/Release/MQ2DotNet/MQ2DotNet.xml -CompressionLevel Optimal -DestinationPath build/Release/MQ2DotNet.zip'
- '$response = (wsl curl --request POST --header "Private-Token: $($env:GITLAB_API_KEY)" --form "file=@build/Release/MQ2DotNet.zip" https://gitlab.com/api/v4/projects/7242930/uploads)'
- 'Write-Host "File uploaded: $($response)"'
- '$fileUrl = "https://gitlab.com/alynel/MQ2DotNet$(($response | ConvertFrom-Json).url)"'
- '$data = @{ "name"=$env:CI_COMMIT_TAG; "tag_name"=$env:CI_COMMIT_TAG; "description"="Auto generated release"; "assets" = @{ "links" = @(@{"name"="Zip"; "url"=$fileUrl})}}'
- 'Write-Host "Creating release: $($data | ConvertTo-Json -Depth 3)"'
- '$response = wsl curl --request POST --header "Content-Type: application/json" --header "Private-Token: $($env:GITLAB_API_KEY)" --data "''$($data | ConvertTo-Json -Depth 3 -Compress)''" https://gitlab.com/api/v4/projects/7242930/releases'
- 'Write-Host "File uploaded: $($response)"'
only:
- tags