1
+ name : .NET Core
2
+ on :
3
+ push :
4
+ pull_request :
5
+ release :
6
+ types :
7
+ - published
8
+ env :
9
+ # Stop wasting time caching packages
10
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
11
+ # Disable sending usage data to Microsoft
12
+ DOTNET_CLI_TELEMETRY_OPTOUT : true
13
+ # Project name to pack and publish
14
+ PROJECT_NAME : fasm
15
+ # GitHub Packages Feed settings
16
+ GITHUB_FEED : https://nuget.pkg.github.com/d-edge/
17
+ GITHUB_USER : thinkbeforecoding
18
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19
+ # Official NuGet Feed settings
20
+ NUGET_FEED : https://api.nuget.org/v3/index.json
21
+ NUGET_KEY : ${{ secrets.NUGET_KEY }}
22
+ jobs :
23
+ build :
24
+ runs-on : ${{ matrix.os }}
25
+ strategy :
26
+ matrix :
27
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
28
+ steps :
29
+ - name : Checkout
30
+ uses : actions/checkout@v2
31
+ - name : Setup .NET Core
32
+ uses : actions/setup-dotnet@v1
33
+ with :
34
+ dotnet-version : 5.0.300
35
+ - name : Tool restore
36
+ run : dotnet tool restore
37
+ - name : Restore
38
+ run : dotnet restore
39
+ - name : Build
40
+ run : dotnet build -c Release --no-restore
41
+ - name : Test
42
+ run : dotnet test -c Release
43
+ - name : Pack
44
+ if : matrix.os == 'ubuntu-latest'
45
+ run : dotnet pack -v normal -c Release --no-restore -p:PackageVersion=$GITHUB_RUN_ID.0.0 src/$PROJECT_NAME/$PROJECT_NAME.fsproj -o bin/nuget
46
+ - name : Upload Artifact
47
+ if : matrix.os == 'ubuntu-latest'
48
+ uses : actions/upload-artifact@v2
49
+ with :
50
+ name : nupkg
51
+ path : ./bin/nuget/*.nupkg
52
+ prerelease :
53
+ needs : build
54
+ if : github.ref == 'refs/heads/develop'
55
+ runs-on : ubuntu-latest
56
+ steps :
57
+ - name : Download Artifact
58
+ uses : actions/download-artifact@v1
59
+ with :
60
+ name : nupkg
61
+ - name : Push to GitHub Feed
62
+ run : |
63
+ for f in ./nupkg/*.nupkg
64
+ do
65
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
66
+ done
67
+ deploy :
68
+ needs : build
69
+ if : github.event_name == 'release'
70
+ runs-on : ubuntu-latest
71
+ steps :
72
+ - uses : actions/checkout@v2
73
+ - name : Setup .NET Core
74
+ uses : actions/setup-dotnet@v1
75
+ with :
76
+ dotnet-version : 5.0.300
77
+ - name : Create Release NuGet package
78
+ run : |
79
+ arrTag=(${GITHUB_REF//\// })
80
+ VERSION="${arrTag[2]}"
81
+ echo Version: $VERSION
82
+ VERSION="${VERSION//v}"
83
+ echo Clean Version: $VERSION
84
+ dotnet pack -v normal -c Release -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.fsproj
85
+ - name : Push to GitHub Feed
86
+ run : |
87
+ for f in ./nupkg/*.nupkg
88
+ do
89
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
90
+ done
91
+ - name : Push to NuGet Feed
92
+ run : dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
0 commit comments