-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (36 loc) · 1.91 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
language: csharp
dotnet: 5.0
mono: none
solution: GraphQL.Tool.Embedded.sln
branches:
only:
- main
before_script:
- dotnet restore
script:
- dotnet build
before_deploy:
- git checkout origin/main && git fetch && git remote set-url origin https://${GITHUB_OAUTH_TOKEN}@github.com/ZEXSM/GraphQL.Tool.Embedded.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/GraphQL.Tool.Embedded
on:
branch: main
after_deploy:
- dotnet nuget push ./src/GraphQL.Tool.Embedded/bin/Release/GraphQL.Tool.Embedded.$PACKAGE_VERSION.nupkg -k $NUGET_API_KEY -s $NUGET_SOURCE