1+ name : Build
2+
3+ on :
4+ # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
5+ push :
6+ branches : [ main ]
7+ # Trigger the workflow on any pull request
8+ pull_request :
9+
10+ jobs :
11+ build :
12+ name : Build
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Fetch Sources
16+ uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+ filter : tree:0
20+ submodules : recursive
21+
22+ - name : Setup .NET environment
23+ uses : actions/setup-dotnet@v3
24+ with :
25+ dotnet-version : " 8.0.100"
26+
27+ - name : Restore project
28+ run : |
29+ dotnet restore
30+ dotnet tool restore
31+
32+ - name : Build and pack solution
33+ run : |
34+ dotnet pack -c Release
35+
36+ - name : Upload thunderstore artifact
37+ uses : actions/upload-artifact@v4
38+ with :
39+ name : thunderstore-build
40+ path : |
41+ ./*/assets/thunderstore.toml.user
42+ ./*/bin/Release/netstandard2.1/dist/*.zip
43+
44+ - name : Upload nupkg artifact
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : nupkg-build
48+ path : ./*/bin/Release/*.nupkg
49+
50+ upload-release-artifacts :
51+ name : Upload Release Artifacts
52+ needs : build
53+ runs-on : ubuntu-latest
54+ steps :
55+ - name : Fetch Sources
56+ uses : actions/checkout@v4
57+
58+ - name : Download all artifacts
59+ uses : actions/download-artifact@v4
60+
61+ - name : Upload artifacts to Release
62+ env :
63+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
64+ run : gh release upload ${{ github.event.release.tag_name }} thunderstore-build/*/bin/Release/netstandard2.1/dist/*.zip nupkg-build/*/bin/Release/*.nupkg
65+
66+ deploy-nuget :
67+ name : Deploy to NuGet
68+ needs : build
69+ runs-on : ubuntu-latest
70+ steps :
71+ - name : Fetch Sources
72+ uses : actions/checkout@v4
73+
74+ - name : Download nupkg artifact
75+ uses : actions/download-artifact@v4
76+ with :
77+ name : nupkg-build
78+
79+ - name : Setup .NET environment
80+ uses : actions/setup-dotnet@v3
81+ with :
82+ dotnet-version : " 8.0.100"
83+
84+ - name : Publish to NuGet.org
85+ run : |
86+ dotnet nuget push ./*/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_TOKEN }} --source https://api.nuget.org/v3/index.json
87+
88+ deploy-thunderstore :
89+ name : Deploy to Thunderstore
90+ needs : build
91+ runs-on : ubuntu-latest
92+ steps :
93+ - name : Fetch Sources
94+ uses : actions/checkout@v4
95+
96+ - name : Download Thunderstore artifact
97+ uses : actions/download-artifact@v4
98+ with :
99+ name : thunderstore-build
100+
101+ - name : Setup .NET environment
102+ uses : actions/setup-dotnet@v3
103+ with :
104+ dotnet-version : " 8.0.100"
105+
106+ - name : Restore dotnet tools
107+ run : |
108+ dotnet tool restore
109+
110+ - name : Publish to Thunderstore
111+ env :
112+ TCLI_AUTH_TOKEN : ${{ secrets.THUNDERSTORE_API_TOKEN }}
113+ run : |
114+ dotnet build -c Release -target:ThunderstorePublish
0 commit comments