-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
88 lines (78 loc) · 2.79 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
88 lines (78 loc) · 2.79 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
78
79
80
81
82
83
84
85
86
87
88
include:
- component: $CI_SERVER_FQDN/fusonic/devops/components/dotnet-test/dotnet-test@2.0.0
inputs:
sln-path: Extensions.slnx
image: mcr.microsoft.com/dotnet/sdk:10.0
- component: $CI_SERVER_FQDN/fusonic/devops/components/dotnet-test/dotnet-check-warnings@2.0.0
inputs:
sln-path: Extensions.slnx
image: mcr.microsoft.com/dotnet/sdk:10.0
- project: "fusonic/devops/images/gitlab-ci-tools"
file: "release_tool.yml"
ref: "5.12"
stages:
- build
- test
- publish
variables:
BUILD_IMAGE: mcr.microsoft.com/dotnet/sdk:10.0
DOCKER_VERSION: "29"
DOCKER_BUILDKIT: 1
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs/${CI_JOB_ID}"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "/certs/${CI_JOB_ID}/client"
TESTCONTAINERS_RYUK_DISABLED: "true" # Disable Ryuk as we're running in dind-rootless and there is no docker.sock available.
default:
interruptible: true
workflow:
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^release\// || $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule"
build:
stage: build
image: ${BUILD_IMAGE}
before_script:
# Workaround for SourceLink: See: https://github.com/dotnet/sourcelink/issues/689
- git config url."https://github.com/fusonic/dotnet-extensions".insteadOf https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/fusonic/devops/dotnet/extensions
script:
- dotnet pack -c Release
artifacts:
when: on_success
paths:
- ./artifacts/package/release/*.nupkg
- ./artifacts/package/release/*.snupkg
rules:
- when: always
dotnet:test:
services:
- docker:${DOCKER_VERSION}-dind-rootless
release:lint-merge-request:
stage: test
release:create:
stage: publish
extends: .release-script
needs: []
dependencies: []
before_script:
- export RELEASE_VERSION=`sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' ./src/Directory.Build.props`
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^release\//
when: manual
publish:
image: ${BUILD_IMAGE}
stage: publish
variables:
GIT_STRATEGY: none
allow_failure: true
script:
- |
if [ $CI_PIPELINE_SOURCE != "merge_request_event" ]; then
echo "Publishing to NuGet.org"
dotnet nuget push "artifacts/package/release/*.nupkg" -k $Nuget_Key -s https://api.nuget.org/v3/index.json --skip-duplicate
fi
- echo "Publishing to GitLab"
- dotnet nuget push "artifacts/package/release/*.nupkg" --source "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/nuget/index.json" --api-key $CI_JOB_TOKEN
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^release\// || $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual