-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
85 lines (76 loc) · 2.13 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
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
# Builds: https://travis-ci.org/martinsmith1968/DNX.Helpers
#
# References:
# https://stackoverflow.com/questions/41509608/how-do-i-deploy-nuget-packages-in-travis-ci
# https://docs.travis-ci.com/user/languages/csharp/
# https://travis-ci.com/bilal-fazlani/commanddotnet/builds/142334958/config
env:
APPNAME=DNX.Helpers
CONFIGURATION=Release
NUGET_API_URL=https://www.nuget.org/api/v2/package
git:
depth: 1
quiet: true
solution: $APPNAME.sln
language: csharp
mono: none
branches:
except:
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
stages:
- name: build
- name: deploy
if: branch = master
- name: release
if: branch = master
jobs:
include:
#----- Build and Test -----#
- stage: build
name: OSX
os: osx
dotnet: 2.2.207
install: dotnet restore
script: dotnet build && dotnet test -v normal
- name: Linux
os: linux
dotnet: 2.2.102
install: dotnet restore
script: dotnet build && dotnet test -v normal
- name: Windows
os: windows
install: dotnet restore
script: dotnet build && dotnet test -v normal
#----- Deploy -----#
- stage: deploy
name: NuGet
os: linux
dotnet: 2.2.102
install: dotnet restore
script: dotnet build
deploy:
provider: script
skip_cleanup: true
script: dotnet pack && dotnet nuget push $APPNAME/bin/$CONFIGURATION/$APPNAME.*.nupkg -s $NUGET_API_URL -k $NUGET_API_KEY --no-service-endpoint
#----- Release -----#
- stage: release
name: GitHub
os: linux
dotnet: 2.2.102
install: dotnet restore
script: dotnet build
before_deploy:
- FILE=$(ls $APPNAME/bin/$CONFIGURATION/$APPNAME.*.nupkg)
- echo $FILE
- VERSION=$(echo $FILE | sed -e "s/$APPNAME\/bin\/$CONFIGURATION\/$APPNAME.//g" -e 's/.nupkg//g')
- echo $VERSION
- export TRAVIS_TAG=v$VERSION
- echo $TRAVIS_TAG
- git tag -f "$TRAVIS_TAG"
deploy:
provider: releases
skip_cleanup: true
api_key: $GITHUB_TOKEN
file_glob: true
file:
- "$APPNAME/bin/$CONFIGURATION/$APPNAME.*.nupkg"