-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
48 lines (48 loc) · 2.7 KB
/
.travis.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
language: csharp
dotnet: 5.0
mono: none
solution: Swagger.Documentation.sln
branches:
only:
- main
before_script:
- dotnet restore
script:
- dotnet build
- dotnet test ./test/Swagger.Documentation.ExceptionTest -c $CONFIGURATION -f net5.0
- dotnet test ./test/Swagger.Documentation.VersionTest -c $CONFIGURATION -f net5.0
- dotnet test ./test/Swagger.Documentation.Test -c $CONFIGURATION -f net5.0
after_success:
- dotnet minicover instrument
- dotnet minicover reset
- dotnet test --no-build ./test/Swagger.Documentation.ExceptionTest -c $CONFIGURATION -f net5.0
- dotnet test --no-build ./test/Swagger.Documentation.VersionTest -c $CONFIGURATION -f net5.0
- dotnet test --no-build ./test/Swagger.Documentation.Test -c $CONFIGURATION -f net5.0
- dotnet minicover uninstrument
- dotnet minicover report
- dotnet minicover coverallsreport --output "coveralls.json" --service-name "travis-ci" --service-job-id $TRAVIS_JOB_ID
before_deploy:
- git checkout origin/main && git fetch && git remote set-url origin https://${GITHUB_OAUTH_TOKEN}@github.com/ZEXSM/Swagger.Documentation.git
- PR_TITLE=$(git log -1 --pretty='%f')
- LAST_TAG=$(echo $(git describe --tags $(git rev-list --tags --max-count=1)) | cut -d'v' -f 2)
- CURRENT_MAJOR=$(echo $LAST_TAG | cut -d. -f 1)
- CURRENT_MINOR=$(echo $LAST_TAG | cut -d. -f 2)
- CURRENT_PATCH=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 1)
- RC=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 2)
- MAJOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MAJOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo $(($CURRENT_MAJOR+1))) || echo $CURRENT_MAJOR)
- MINOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MINOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo $(($CURRENT_MINOR+1))) || echo $CURRENT_MINOR)
- PATCH=$(([ "$RC" == "rc" ] && echo $CURRENT_PATCH) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo 0) || echo $(($CURRENT_PATCH+1)))
- NEW_TAG=$(echo $MAJOR.$MINOR.$PATCH)
- PACKAGE_VERSION=${NEW_TAG:-$DEFAULT_PACKAGE_VERSION}
- git tag v$PACKAGE_VERSION && git push origin v$PACKAGE_VERSION
- dotnet pack -c $CONFIGURATION -p:PackageVersion=$PACKAGE_VERSION
deploy:
provider: releases
name: v$PACKAGE_VERSION
token: $GITHUB_OAUTH_TOKEN
cleanup: true
repo: ZEXSM/Swagger.Documentation
on:
branch: main
after_deploy:
- dotnet nuget push ./src/Swagger.Documentation/bin/Release/Swagger.Documentation.$PACKAGE_VERSION.nupkg -k $NUGET_API_KEY -s $NUGET_SOURCE