-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
74 lines (68 loc) · 2.24 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
74 lines (68 loc) · 2.24 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
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH'
- if: '$CI_COMMIT_TAG'
stages:
- test
- package
- promote
dotnet:test:
stage: test
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet restore slskNet.Runtime.sln
- dotnet build slskNet.Runtime.sln --configuration Release --no-restore
- dotnet test slskNet.Runtime.sln --configuration Release --no-build --filter "FullyQualifiedName!~Integration"
dotnet:pack:
stage: package
image: mcr.microsoft.com/dotnet/sdk:9.0
needs: ["dotnet:test"]
script:
- dotnet pack src/Soulseek.csproj --configuration Release --output artifacts/nuget
artifacts:
when: always
paths:
- artifacts/nuget/*.nupkg
- artifacts/nuget/*.snupkg
expire_in: 14 days
.github_publication_defaults:
variables:
GITHUB_MIRROR_URL: "git@github.com:snapetech/slskNet.Runtime.git"
GITHUB_REPOSITORY: "snapetech/slskNet.Runtime"
# External publication is intentionally gated on all earlier GitLab stages.
# Set GITHUB_MIRROR_SSH_KEY, GITHUB_TOKEN, and GHCR_TOKEN in GitLab CI as needed.
github:mirror:
extends: .github_publication_defaults
stage: promote
image: alpine:3.21
before_script:
- apk add --no-cache git openssh-client
- eval "$(ssh-agent -s)"
- printf '%s\n' "$GITHUB_MIRROR_SSH_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- ssh-keyscan github.com >> ~/.ssh/known_hosts
script:
- test -n "$GITHUB_MIRROR_URL"
- git remote add github-mirror "$GITHUB_MIRROR_URL"
- |
if [ -n "$CI_COMMIT_TAG" ]; then
git push github-mirror "refs/tags/$CI_COMMIT_TAG:refs/tags/$CI_COMMIT_TAG"
else
git push github-mirror "HEAD:$CI_COMMIT_REF_NAME"
fi
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG'
github:release:
extends: .github_publication_defaults
stage: promote
image:
name: ghcr.io/cli/cli:2.63.2
entrypoint: [""]
needs: ["github:mirror"]
script:
- test -n "$GITHUB_TOKEN"
- test -n "$GITHUB_REPOSITORY"
- gh release create "$CI_COMMIT_TAG" --repo "$GITHUB_REPOSITORY" --title "$CI_COMMIT_TAG" --notes "Released from GitLab pipeline $CI_PIPELINE_URL" --verify-tag
rules:
- if: '$CI_COMMIT_TAG'