-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
77 lines (70 loc) · 3.11 KB
/
.gitlab-ci.yml
File metadata and controls
77 lines (70 loc) · 3.11 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
workflow:
rules:
- if: $GITLAB_USER_LOGIN == "taggart"
when: never
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- $Env:Path = [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine)
- $Env:Message = $MESSAGE
stages:
- build
- release_gitlab
- release_github
build:
except:
- merge_requests
- pipelines
stage: build
tags: [windows,csharp]
script:
- '& $MSBUILD_FULL_PATH -p:configuration=release -t:restore -p:RestorePackagesConfig=true /p:RestoreSources=$NUGET_SOURCE'
- '& $MSBUILD_FULL_PATH -p:configuration=release'
- $Env:BUILD_VERSION = (get-item -path .\source\fragmentlab\bin\anycpu\release\net48\FragmentLab.exe).VersionInfo.ProductVersion
artifacts:
untracked: true
when: always
release_gitlab:
stage: release_gitlab
tags: [windows,csharp]
script:
- $Env:BUILD_VERSION = (get-item -path .\source\fragmentlab\bin\anycpu\release\net48\FragmentLab.exe).VersionInfo.ProductVersion
- Invoke-RestMethod -Headers @{ "JOB-TOKEN"="$CI_JOB_TOKEN"; "Content-Type"="multipart/form-data" } -InFile source/installer/bin/release/installer.msi -uri "https://bms-developer.science.uu.nl/api/v4/projects/99/packages/generic/FragmentLab/$Env:BUILD_VERSION/installer.msi" -Method put
- git remote set-url origin git@bms-developer.science.uu.nl:csharp/shotgun/fragmentlab.git
- git tag -a "$Env:BUILD_VERSION" -m "$Env:BUILD_VERSION:\n$Env:Message"
- git push origin $Env:BUILD_VERSION
- mkdir release-cli
- curl.exe -L https://release-cli-downloads.s3.amazonaws.com/latest/release-cli-windows-amd64.exe --output release-cli\release-cli.exe
- $cliDir = (Get-Item .).FullName+"\release-cli\"
- '$env:Path += ";$cliDir"'
- $env:asset = "{`"name`":`"Installer`",`"url`":`"https://bms-developer.science.uu.nl/api/v4/projects/99/packages/generic/FragmentLab/$Env:BUILD_VERSION/installer.msi`"}"
- $env:assetjson = $env:asset | ConvertTo-Json
- release-cli --insecure-https=true create --name $Env:BUILD_VERSION --description "$Env:BUILD_VERSION $Env:Message" --tag-name $Env:BUILD_VERSION --assets-link=$env:assetjson
rules:
- if: '$CI_COMMIT_MESSAGE=~/^RELEASE/'
- if: '$OVERRIDE_RELEASE'
artifacts:
untracked: true
when: always
dependencies:
- build
release_github:
stage: release_github
tags: [windows,csharp]
script:
- $Env:BUILD_VERSION = (get-item -path .\source\fragmentlab\bin\anycpu\release\net48\FragmentLab.exe).VersionInfo.ProductVersion
- git remote set-url origin "https://$BASTIAAN_ACCESS@github.com/ScheltemaLab/FragmentLab"
- git push origin $Env:BUILD_VERSION
- git push origin HEAD:master
- gh release create $Env:BUILD_VERSION -t "$Env:BUILD_VERSION $Env:Message" -n "$Env:BUILD_VERSION $Env:Message"
- gh release upload $Env:BUILD_VERSION source/installer/bin/release/installer.msi
- gh release upload $Env:BUILD_VERSION (dir source/FragmentLab/bin/anycpu/release/net48/hecklib*dll)
rules:
- if: '$CI_COMMIT_MESSAGE=~/^RELEASE/'
- if: '$OVERRIDE_RELEASE'
artifacts:
untracked: true
when: always
dependencies:
- build