12
12
compile-flags : " --self-contained=true -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=None"
13
13
14
14
jobs :
15
- Build :
15
+ build :
16
16
runs-on : ubuntu-latest
17
- if : ${{ !contains(github.event.head_commit.message, 'skip ci') }}
17
+ if : ${{ always() }}
18
+ needs : [determine-build, fetch-translations]
18
19
timeout-minutes : 15
20
+ strategy :
21
+ matrix :
22
+ target : [win-x86, win-x64, win-arm, win-arm64, linux-x64, linux-arm, linux-arm64, osx-x64, osx-arm64]
19
23
20
24
steps :
21
-
22
25
- name : Checkout
23
26
uses : actions/checkout@v3
24
27
with :
25
28
fetch-depth : 0
26
29
submodules : ' true'
30
+
31
+ - name : Get Current Date
32
+ run : |
33
+ echo date=$(date +'%Y%m%d') >> $GITHUB_ENV
34
+ echo date_dashed=$(date -u +'%Y-%m-%d') >> $GITHUB_ENV
35
+
36
+ - name : Restore Translations (if available)
37
+ uses : actions/cache/restore@v3
38
+ with :
39
+ path : ${{ github.workspace }}/*
40
+ key : " translation-${{ github.sha }}"
41
+ restore-keys : " translation-"
42
+
43
+ - name : Setup Environment Variables (early)
44
+ run : |
45
+ echo project-path=${{ github.workspace }}/${{ env.PROJECT }} >> $GITHUB_ENV
46
+ echo file-ext=${{ (startsWith(matrix.target, 'win') && '.exe') || ' ' }} >> $GITHUB_ENV
47
+
48
+ - name : Setup Environment Variables
49
+ run : |
50
+ echo target-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/${{ matrix.target }}/publish/ >> $GITHUB_ENV
51
+ echo assembly-info=${{ env.project-path }}/Properties/AssemblyInfo.cs >> $GITHUB_ENV
52
+ echo build-version-info=${{ env.date_dashed }}-${{ github.run_number }} >> $GITHUB_ENV
53
+ echo commit=$(echo ${{ github.sha }} | cut -c 1-7) >> $GITHUB_ENV
54
+
55
+ - name : Setup Environment Variables (late)
56
+ run : |
57
+ echo built-executable-path=${{ env.target-out-path }}${{ env.PROJECT }}${{ env.file-ext }} >> $GITHUB_ENV
58
+
59
+ - name : Set Version Info
60
+ run : |
61
+ echo '' >> ${{ env.assembly-info }}
62
+ echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ env.date_dashed }} from commit ${{ env.commit }}\")]" >> ${{ env.assembly-info }}
63
+
64
+ - name : Build Target
65
+ run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r ${{ matrix.target }} ${{ env.compile-flags }}
66
+ env :
67
+ DOTNET_NOLOGO : true
27
68
69
+ - name : Target Publish Executable
70
+ uses : tix-factory/release-manager@v1
71
+ with :
72
+ github_token : ${{ secrets.GITHUB_TOKEN }}
73
+ mode : uploadReleaseAsset
74
+ filePath : ${{ env.built-executable-path }}
75
+ assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-${{ matrix.target }}${{ (startsWith(matrix.target, 'win') && '.exe') || ' ' }}
76
+ tag : ${{ format('{0}-{1}', env.date, github.run_number) }}
77
+
78
+ fetch-translations :
79
+ strategy :
80
+ fail-fast : true
81
+ runs-on : ubuntu-latest
82
+ needs : determine-build
83
+ # Only works in MCCTeam repository, since it needs crowdin secrets.
84
+ if : ${{ github.repository == 'MCCTeam/Minecraft-Console-Client' }}
85
+ timeout-minutes : 15
86
+
87
+ steps :
88
+ - name : Cache
89
+
90
+ id : cache-check
91
+ with :
92
+ path : ${{ github.workspace }}/*
93
+ key : ' translation-${{ github.sha }}'
94
+
28
95
- name : Download translations from crowdin
29
96
97
+ if : steps.cache-check.outputs.cache-hit != 'true'
30
98
with :
31
99
upload_sources : true
32
100
upload_translations : false
@@ -41,227 +109,81 @@ jobs:
41
109
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42
110
CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
43
111
CROWDIN_PERSONAL_TOKEN : ${{ secrets.CROWDIN_TOKEN }}
44
-
45
- - name : Setup Project Path
112
+
113
+ build-transition-version :
114
+ runs-on : ubuntu-latest
115
+ if : ${{ always() }}
116
+ needs : [determine-build, fetch-translations]
117
+ timeout-minutes : 15
118
+ strategy :
119
+ fail-fast : true
120
+ matrix :
121
+ target : [win-x86, win-x64, linux-x64, linux-arm64, osx-x64]
122
+
123
+ steps :
124
+ - name : Checkout
125
+ uses : actions/checkout@v3
126
+ with :
127
+ fetch-depth : 0
128
+ submodules : ' true'
129
+
130
+ - name : Get Current Date
131
+ run : |
132
+ echo date=$(date +'%Y%m%d') >> $GITHUB_ENV
133
+ echo date_dashed=$(date -u +'%Y-%m-%d') >> $GITHUB_ENV
134
+
135
+ - name : Restore Translations (if available)
136
+ uses : actions/cache/restore@v3
137
+ with :
138
+ path : ${{ github.workspace }}/*
139
+ key : " translation-${{ github.sha }}"
140
+ restore-keys : " translation-"
141
+
142
+ - name : Setup Environment Variables (early)
46
143
run : |
47
144
echo project-path=${{ github.workspace }}/${{ env.PROJECT }} >> $GITHUB_ENV
145
+ echo file-ext=${{ (startsWith(matrix.target, 'win') && '.exe') || ' ' }} >> $GITHUB_ENV
48
146
49
- - name : Setup Output Paths
147
+ - name : Setup Environment Variables
50
148
run : |
51
- echo win-x86-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x86/publish/ >> $GITHUB_ENV
52
- echo win-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x64/publish/ >> $GITHUB_ENV
53
- echo win-arm32-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-arm/publish/ >> $GITHUB_ENV
54
- echo win-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-arm64/publish/ >> $GITHUB_ENV
55
- echo linux-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-x64/publish/ >> $GITHUB_ENV
56
- echo linux-arm32-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm/publish/ >> $GITHUB_ENV
57
- echo linux-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm64/publish/ >> $GITHUB_ENV
58
- echo osx-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-x64/publish/ >> $GITHUB_ENV
59
- echo osx-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-arm64/publish/ >> $GITHUB_ENV
60
-
61
- - name : Setup .NET SDK
62
-
63
-
64
- - name : Get Version DateTime
65
- id : date-version
66
-
67
- with :
68
- timeZone : 0
69
- format : ' YYYY-MM-DD'
70
-
71
- - name : VersionInfo
149
+ echo target-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/${{ matrix.target }}/publish/ >> $GITHUB_ENV
150
+ echo assembly-info=${{ env.project-path }}/Properties/AssemblyInfo.cs >> $GITHUB_ENV
151
+ echo build-version-info=${{ env.date_dashed }}-${{ github.run_number }} >> $GITHUB_ENV
152
+ echo commit=$(echo ${{ github.sha }} | cut -c 1-7) >> $GITHUB_ENV
153
+
154
+ - name : Setup Environment Variables (late)
72
155
run : |
73
- COMMIT=$(echo ${{ github.sha }} | cut -c 1-7)
74
- echo '' >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
75
- echo build-version-info=${{ steps.date-version.outputs.time }}-${{ github.run_number }} >> $GITHUB_ENV
76
- echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT\")]" >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
77
-
78
- - name : Build for Windows x86
79
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x86 ${{ env.compile-flags }}
80
-
81
- - name : Zip Windows x86 Build
82
- run : zip -qq -r windows-x86.zip *
83
- working-directory : ${{ env.win-x86-out-path }}
84
-
85
- - name : Build for Windows x64
86
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x64 ${{ env.compile-flags }}
87
-
88
- - name : Zip Windows x64 Build
89
- run : zip -qq -r windows-x64.zip *
90
- working-directory : ${{ env.win-x64-out-path }}
91
-
92
- - name : Build for Windows ARM32
93
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-arm ${{ env.compile-flags }}
94
-
95
- - name : Build for Windows ARM64
96
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-arm64 ${{ env.compile-flags }}
97
-
98
- - name : Build for Linux X64
99
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-x64 ${{ env.compile-flags }}
100
-
101
- - name : Zip Linux X64 Build
102
- run : zip -qq -r linux.zip *
103
- working-directory : ${{ env.linux-x64-out-path }}
104
-
105
- - name : Build for Linux ARM32
106
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm ${{ env.compile-flags }}
107
-
108
- - name : Build for Linux ARM64
109
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm64 ${{ env.compile-flags }}
110
-
111
- - name : Zip ARM64 Linux Build
112
- run : zip -qq -r linux-arm64.zip *
113
- working-directory : ${{ env.linux-arm64-out-path }}
114
-
115
- - name : Build for OSX X64
116
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-x64 ${{ env.compile-flags }}
117
-
118
- - name : Zip OSX Build
119
- run : zip -qq -r osx.zip *
120
- working-directory : ${{ env.osx-x64-out-path }}
121
-
122
- - name : Build for OSX ARM64
123
- run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-arm64 ${{ env.compile-flags }}
124
-
125
- - name : Get Release DateTime
126
- id : date-release
127
-
128
- with :
129
- timeZone : 0
130
- format : ' YYYYMMDD'
131
-
132
- - name : Windows X86 Release
133
- uses : tix-factory/release-manager@v1
134
- with :
135
- github_token : ${{ secrets.GITHUB_TOKEN }}
136
- mode : uploadReleaseAsset
137
- filePath : ${{ env.win-x86-out-path }}${{ env.PROJECT }}.exe
138
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-X86.exe
139
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
140
-
141
- - name : Windows X64 Release
142
- uses : tix-factory/release-manager@v1
143
- with :
144
- github_token : ${{ secrets.GITHUB_TOKEN }}
145
- mode : uploadReleaseAsset
146
- filePath : ${{ env.win-x64-out-path }}${{ env.PROJECT }}.exe
147
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-X64.exe
148
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
149
-
150
- - name : Windows ARM32 Release
151
- uses : tix-factory/release-manager@v1
152
- with :
153
- github_token : ${{ secrets.GITHUB_TOKEN }}
154
- mode : uploadReleaseAsset
155
- filePath : ${{ env.win-arm32-out-path }}${{ env.PROJECT }}.exe
156
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-Arm32.exe
157
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
158
-
159
- - name : Windows ARM64 Release
160
- uses : tix-factory/release-manager@v1
161
- with :
162
- github_token : ${{ secrets.GITHUB_TOKEN }}
163
- mode : uploadReleaseAsset
164
- filePath : ${{ env.win-arm64-out-path }}${{ env.PROJECT }}.exe
165
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-Arm64.exe
166
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
167
-
168
- - name : Linux X64 Release
169
- uses : tix-factory/release-manager@v1
170
- with :
171
- github_token : ${{ secrets.GITHUB_TOKEN }}
172
- mode : uploadReleaseAsset
173
- filePath : ${{ env.linux-x64-out-path }}${{ env.PROJECT }}
174
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-X64
175
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
176
-
177
- - name : Linux ARM32 Release
178
- uses : tix-factory/release-manager@v1
179
- with :
180
- github_token : ${{ secrets.GITHUB_TOKEN }}
181
- mode : uploadReleaseAsset
182
- filePath : ${{ env.linux-arm32-out-path }}${{ env.PROJECT }}
183
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-Arm32
184
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
185
-
186
- - name : Linux ARM64 Release
187
- uses : tix-factory/release-manager@v1
188
- with :
189
- github_token : ${{ secrets.GITHUB_TOKEN }}
190
- mode : uploadReleaseAsset
191
- filePath : ${{ env.linux-arm64-out-path }}${{ env.PROJECT }}
192
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-Arm64
193
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
194
-
195
- - name : OSX X64 Release
196
- uses : tix-factory/release-manager@v1
197
- with :
198
- github_token : ${{ secrets.GITHUB_TOKEN }}
199
- mode : uploadReleaseAsset
200
- filePath : ${{ env.osx-x64-out-path }}${{ env.PROJECT }}
201
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-OSX-X64
202
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
203
-
204
- - name : OSX ARM64 Release
205
- uses : tix-factory/release-manager@v1
206
- with :
207
- github_token : ${{ secrets.GITHUB_TOKEN }}
208
- mode : uploadReleaseAsset
209
- filePath : ${{ env.win-x64-out-path }}windows-x64.zip
210
- assetName : ${{ env.PROJECT }}-${{ env.build-version-info }}-OSX-Arm64
211
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
212
-
213
- - name : Windows X64 Release (transition version)
214
- uses : tix-factory/release-manager@v1
215
- with :
216
- github_token : ${{ secrets.GITHUB_TOKEN }}
217
- mode : uploadReleaseAsset
218
- filePath : ${{ env.win-x64-out-path }}windows-x64.zip
219
- assetName : ${{ env.PROJECT }}-windows-x64.zip
220
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
156
+ echo built-executable-path=${{ env.target-out-path }}${{ env.PROJECT }}${{ env.file-ext }} >> $GITHUB_ENV
221
157
222
- - name : Windows X86 Release (transition version)
223
- uses : tix-factory/release-manager@v1
224
- with :
225
- github_token : ${{ secrets.GITHUB_TOKEN }}
226
- mode : uploadReleaseAsset
227
- filePath : ${{ env.win-x86-out-path }}windows-x86.zip
228
- assetName : ${{ env.PROJECT }}-windows-x86.zip
229
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
158
+ - name : Set Version Info
159
+ run : |
160
+ echo '' >> ${{ env.assembly-info }}
161
+ echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ env.date_dashed }} from commit ${{ env.commit }}\")]" >> ${{ env.assembly-info }}
230
162
231
- - name : Linux X64 Release (transition version)
232
- uses : tix-factory/release-manager@v1
233
- with :
234
- github_token : ${{ secrets.GITHUB_TOKEN }}
235
- mode : uploadReleaseAsset
236
- filePath : ${{ env.linux-x64-out-path }}linux.zip
237
- assetName : ${{ env.PROJECT }}-linux.zip
238
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
163
+ - name : Build Target
164
+ run : dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r ${{ matrix.target }} ${{ env.compile-flags }}
165
+ env :
166
+ DOTNET_NOLOGO : true
239
167
240
- - name : Linux ARM64 Release (transition version)
241
- uses : tix-factory/release-manager@v1
242
- with :
243
- github_token : ${{ secrets.GITHUB_TOKEN }}
244
- mode : uploadReleaseAsset
245
- filePath : ${{ env.linux-arm64-out-path }}linux-arm64.zip
246
- assetName : ${{ env.PROJECT }}-linux-arm64.zip
247
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
168
+ - name : Zip Target
169
+ run : zip -qq -r mcc-${{ matrix.target }}.zip *
170
+ working-directory : ${{ env.target-out-path }}
248
171
249
- - name : OSX X64 Release (transition version)
172
+ - name : Target Publish Executable
250
173
uses : tix-factory/release-manager@v1
251
174
with :
252
175
github_token : ${{ secrets.GITHUB_TOKEN }}
253
176
mode : uploadReleaseAsset
254
- filePath : ${{ env.osx-x64-out-path }}osx.zip
255
- assetName : ${{ env.PROJECT }}-osx.zip
256
- tag : ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
257
-
258
- - name : Deploy Documentation Site
259
- uses : jenkey2011/vuepress-deploy@master
260
- env :
261
- ACCESS_TOKEN : ${{ secrets.GH_PAGES_TOKEN }}
262
- TARGET_REPO : MCCTeam/MCCTeam.github.io
263
- TARGET_BRANCH : master
264
- BUILD_SCRIPT : yarn --cwd ./docs/ && yarn --cwd ./docs/ docs:build
265
- BUILD_DIR : docs/.vuepress/dist
266
- COMMIT_MESSAGE : Build from ${{ github.sha }}
267
- CNAME : https://mccteam.github.io
177
+ filePath : ${{ env.target-out-path }}/mcc-${{ matrix.target }}.zip
178
+ # ${{ env.PROJECT }}-linux.zip
179
+ assetName : ${{ env.PROJECT }}-${{ (contains(matrix.target, 'linux-x64') && 'linux.zip') || (contains(matrix.target, 'win-x86') && 'windows-x86.zip') || (contains(matrix.target, 'win-x64') && 'windows-x64.zip') || (contains(matrix.target, 'linux-arm64') && 'linux-arm64.zip') || (contains(matrix.target, 'osx-x64') && 'osx.zip') }}
180
+ tag : ${{ format('{0}-{1}', env.date, github.run_number) }}
181
+
182
+ determine-build :
183
+ runs-on : ubuntu-latest
184
+ strategy :
185
+ fail-fast : true
186
+ if : ${{ !contains(github.event.head_commit.message, 'skip ci') }}
187
+ steps :
188
+ - name : dummy action
189
+ run : " echo 'dummy action'"
0 commit comments