-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
104 lines (96 loc) · 2.98 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
stages:
- init
- build
- deploy
- release
Versions:
stage: init
tags:
- docker
image: mcr.microsoft.com/dotnet/sdk:5.0-alpine
before_script:
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git remote set-url origin "${GIT_RO_URL}"
script:
- pwsh -f ./Build/scripts/Define-Version.ps1 --% -bid "${CI_COMMIT_BRANCH}" -tid "${CI_COMMIT_TAG}" -mid "${CI_MERGE_REQUEST_ID}" -cid "${CI_COMMIT_SHORT_SHA}" -buildCounter "${CI_PIPELINE_ID}" -envFile "build.env"
artifacts:
reports:
dotenv: build.env
expire_in: 1 week
Nuget cache:
stage: init
tags:
- windows
- dotnet
- powershell
before_script:
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
script:
- dotnet restore Faelyn.sln
after_script:
- dotnet nuget remove source gitlab
artifacts:
untracked: true
expire_in: 1 week
Nuget output:
stage: build
tags:
- windows
- dotnet
- powershell
before_script:
- echo "Version is $env:CI_STANDARD_VER $env:CI_SEMAMTIC_VER"
script:
- dotnet build Faelyn.sln --no-restore -c Release "/p:Version=$($env:CI_STANDARD_VER)" "/p:InformationalVersion=$($env:CI_SEMAMTIC_VER)" "/p:PackageVersion=$($env:CI_SEMAMTIC_VER)"
artifacts:
paths:
- Build/packages/output
expire_in: 1 week
needs:
- job: Versions
artifacts: true
- job: Nuget cache
artifacts: true
Nuget Gitlab:
stage: deploy
tags:
- docker
image: mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12
before_script:
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
script:
- dotnet nuget push "Build/packages/output/*.nupkg" --source gitlab
- dotnet nuget push "Build/packages/output/*.snupkg" --source gitlab
after_script:
- dotnet nuget remove source gitlab
needs:
- job: Nuget output
artifacts: true
Branch release:
stage: release
tags:
- docker
image: mcr.microsoft.com/dotnet/sdk:5.0-alpine
rules:
- if: $CI_COMMIT_TAG
before_script:
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git remote set-url origin "${GIT_RW_URL}"
script:
- pwsh -f ./Build/scripts/Branch-Release.ps1 --% "${CI_COMMIT_TAG}"
after_script:
- git remote set-url origin "${GIT_RO_URL}"
Nuget release:
stage: release
tags:
- docker
image: mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12
rules:
- if: '$CI_COMMIT_TAG && $NUGET_PUBLIC_ENABLED == "true"'
script:
- dotnet nuget push "Build/packages/output/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${NUGET_PUBLIC_APIKEY}
needs:
- job: Nuget output
artifacts: true