1
+ name : .NET Core
2
+ on :
3
+ push :
4
+ pull_request :
5
+ release :
6
+ types :
7
+ - published
8
+ env :
9
+ PROJECT_NAME : Giraffe.Razor
10
+ GITHUB_SOURCE : https://nuget.pkg.github.com/giraffe-fsharp/
11
+ GITHUB_USER : dustinmoris
12
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13
+ NUGET_KEY : ${{ secrets.NUGET_KEY }}
14
+ jobs :
15
+ build :
16
+ runs-on : ${{ matrix.os }}
17
+ strategy :
18
+ matrix :
19
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
20
+ steps :
21
+ - uses : actions/checkout@v2
22
+ - name : Setup .NET Core
23
+ uses : actions/setup-dotnet@v1
24
+ with :
25
+ dotnet-version : 3.1.301
26
+ - name : Restore
27
+ run : dotnet restore
28
+ - name : Build
29
+ run : dotnet build --configuration Release --no-restore
30
+ - name : Test
31
+ run : dotnet test --configuration Release
32
+ - name : Pack
33
+ if : matrix.os == 'ubuntu-latest'
34
+ run : dotnet pack --configuration Release --no-restore --verbosity normal --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.*proj
35
+ - name : Upload Artifact
36
+ if : matrix.os == 'ubuntu-latest'
37
+ uses : actions/upload-artifact@v2
38
+ with :
39
+ name : nupkg
40
+ path : ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
41
+ prerelease :
42
+ needs : build
43
+ if : github.ref == 'refs/heads/develop'
44
+ runs-on : ubuntu-latest
45
+ steps :
46
+ - name : Download Artifact
47
+ uses : actions/download-artifact@v1
48
+ with :
49
+ name : nupkg
50
+ - name : Push Pre-Release NuGet
51
+ run : |
52
+ for f in ./nupkg/*.nupkg
53
+ do
54
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_SOURCE
55
+ done
56
+ shell : bash
57
+ deploy :
58
+ needs : build
59
+ if : github.event_name == 'release'
60
+ runs-on : ubuntu-latest
61
+ steps :
62
+ - uses : actions/checkout@v2
63
+ - name : Setup .NET Core
64
+ uses : actions/setup-dotnet@v1
65
+ with :
66
+ dotnet-version : 3.1.301
67
+ - name : Create Release NuGet package
68
+ run : |
69
+ arrTag=(${GITHUB_REF//\// })
70
+ VERSION="${arrTag[2]}"
71
+ echo Version: $VERSION
72
+ VERSION="${VERSION//v}"
73
+ echo Clean Version: $VERSION
74
+ dotnet pack --configuration Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
75
+ - name : Push to GitHub Feed
76
+ run : |
77
+ for f in ./nupkg/*.nupkg
78
+ do
79
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_SOURCE
80
+ done
81
+ shell : bash
82
+ - name : Push to NuGet Feed
83
+ run : dotnet nuget push nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_KEY
0 commit comments