-
Notifications
You must be signed in to change notification settings - Fork 3
208 lines (167 loc) · 9.59 KB
/
deploy.yml
File metadata and controls
208 lines (167 loc) · 9.59 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: .NET CI/CD
on:
workflow_dispatch:
push:
branches:
- "**"
tags:
- 'v*'
release:
types: [created]
jobs:
build:
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/') == false && contains(github.event.head_commit.message, '[no ci]') == false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: nuget restore
- name: Build
run: dotnet build -c Release -p:DebugType=None -p:DebugSymbols=false
- name: Create development artifacts
run: |
mkdir artifacts
mkdir artifacts\shared\MapChooserSharp.API\
mkdir artifacts\plugins\MapChooserSharp\
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\MapChooserSharp.dll" -Destination "artifacts\plugins\MapChooserSharp\MapChooserSharp.dll" -Force
Copy-Item -Path "MapChooserSharp.API\bin\Release\*\MapChooserSharp.API.dll" -Destination "artifacts\shared\MapChooserSharp.API\MapChooserSharp.API.dll" -Force
Copy-Item -Path "lang\" -Destination "artifacts\plugins\MapChooserSharp\" -Recurse -Force
- name: Compress artifacts
run: |
Compress-Archive -Path artifacts/* -Destination MapChooserSharp-Development.zip
- name: Upload development assets
uses: actions/upload-artifact@v4
with:
name: MapChooserSharp-Development
path: |
MapChooserSharp-Development.zip
publish:
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: nuget restore
- name: Build
run: dotnet publish -c Release -p:DebugType=None -p:DebugSymbols=false
- name: Create release artifacts
run: |
mkdir artifacts
mkdir artifacts\shared\MapChooserSharp.API\
mkdir artifacts\plugins\MapChooserSharp\
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\MapChooserSharp.dll" -Destination "artifacts\plugins\MapChooserSharp\MapChooserSharp.dll" -Force
Copy-Item -Path "MapChooserSharp.API\bin\Release\*\MapChooserSharp.API.dll" -Destination "artifacts\shared\MapChooserSharp.API\MapChooserSharp.API.dll" -Force
Copy-Item -Path "lang\" -Destination "artifacts\plugins\MapChooserSharp\" -Recurse -Force
- name: Copy and create linux x64 artifact
run: |
mkdir artifacts-linux-x64\
Copy-Item -Path "artifacts\*" -Destination "artifacts-linux-x64\" -Force -Recurse
- name: Copy and create artifacts with dependencies
run: |
mkdir artifacts-linux-x64-with-dependencies\
mkdir artifacts-windows-x64-with-dependencies\
Copy-Item -Path "artifacts-linux-x64\*" -Destination "artifacts-linux-x64-with-dependencies\" -Force -Recurse
Copy-Item -Path "artifacts\*" -Destination "artifacts-windows-x64-with-dependencies\" -Force -Recurse
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\Dapper.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\Dapper.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\Dapper.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\Dapper.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\System.Data.SQLite.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\System.Data.SQLite.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\System.Data.SQLite.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\System.Data.SQLite.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\MySqlConnector.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\MySqlConnector.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\MySqlConnector.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\MySqlConnector.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\Npgsql.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\Npgsql.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\Npgsql.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\Npgsql.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\ZLinq.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\ZLinq.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\ZLinq.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\ZLinq.dll" -Force
- name: Copy runtime artifacts
run: |
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\runtimes\win-x64\native\SQLite.Interop.dll" -Destination "artifacts-windows-x64-with-dependencies\plugins\MapChooserSharp\SQLite.Interop.dll" -Force
Copy-Item -Path "MapChooserSharp\bin\Release\net8.0\publish\runtimes\linux-x64\native\SQLite.Interop.dll" -Destination "artifacts-linux-x64-with-dependencies\plugins\MapChooserSharp\SQLite.Interop.dll" -Force
- name: TNCSSPluginFoundation Download from GitHub
run: Invoke-WebRequest https://github.com/fltuna/TNCSSPluginFoundation/releases/latest/download/TNCSSPluginFoundation.zip -OutFile TNCSSPluginFoundation.zip
- name: TNCSSPluginFoundation Extract ZIP and put into artifacts
run: Expand-Archive -Path TNCSSPluginFoundation.zip -DestinationPath TNCSSPluginFoundation-Extracted\
- name: Copy TNCSSPluginFoundation to with dependencies artifacts
run: |
Copy-Item -Path "TNCSSPluginFoundation-Extracted\*" -Destination "artifacts-windows-x64-with-dependencies\" -Force -Recurse
Copy-Item -Path "TNCSSPluginFoundation-Extracted\*" -Destination "artifacts-linux-x64-with-dependencies\" -Force -Recurse
- name: NativeVoteAPI Download from GitHub
run: Invoke-WebRequest https://github.com/fltuna/NativeVoteAPI-CS2/releases/latest/download/NativeVoteAPI.zip -OutFile NativeVoteAPI.zip
- name: NativeVoteAPI Extract ZIP and put into artifacts
run: Expand-Archive -Path NativeVoteAPI.zip -DestinationPath NativeVoteAPI-Extracted\
- name: Copy NativeVoteAPI to with dependencies artifacts
run: |
Copy-Item -Path "NativeVoteAPI-Extracted\*" -Destination "artifacts-windows-x64-with-dependencies\" -Force -Recurse
Copy-Item -Path "NativeVoteAPI-Extracted\*" -Destination "artifacts-linux-x64-with-dependencies\" -Force -Recurse
- name: Compress artifacts
run: |
Compress-Archive -Path artifacts/* -Destination MapChooserSharp-win-x64.zip
Compress-Archive -Path artifacts-linux-x64/* -Destination MapChooserSharp-linux-x64.zip
Compress-Archive -Path artifacts-windows-x64-with-dependencies/* -Destination MapChooserSharp-win-x64-with-dependencies.zip
Compress-Archive -Path artifacts-linux-x64-with-dependencies/* -Destination MapChooserSharp-linux-x64-with-dependencies.zip
- name: Upload release assets
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
MapChooserSharp-win-x64.zip
MapChooserSharp-linux-x64.zip
MapChooserSharp-win-x64-with-dependencies.zip
MapChooserSharp-linux-x64-with-dependencies.zip
release:
runs-on: windows-latest
needs: publish
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-artifacts
path: artifacts/
- name: check files
run : |
tree
- name: Create Release and Upload Asset
run: |
gh release create "${{ github.ref_name }}" --title "Release ${{ github.ref_name }}" --generate-notes --draft=false artifacts/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-nuget:
runs-on: windows-latest
needs: release
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore
working-directory: MapChooserSharp.API
- name: Build
run: dotnet build -c Release -p:DebugType=None -p:DebugSymbols=false
working-directory: MapChooserSharp.API
- name: Pack
run: dotnet pack --configuration Release
working-directory: MapChooserSharp.API
- name: Extract version
id: package_version
run: |
$xml = [Xml] (Get-Content MapChooserSharp.API/MapChooserSharp.API.csproj)
$version = $xml.Project.PropertyGroup.PackageVersion
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh
- name: Publish to Nuget
run: |
dotnet nuget push "bin/Release/MapChooserSharp.API.${{env.VERSION}}.nupkg" --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
working-directory: MapChooserSharp.API