-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (192 loc) · 8.34 KB
/
build-master.yml
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: BuildGame
on:
push:
branches: [ "master", "main" ]
jobs:
# ---------------------------------------------------------------------------------------
set_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore tools
run: dotnet tool restore
- name: Get version
run: dotnet tool run ezpipeline git-height-version -- -b 0.0.1 -v BUILD_VERSION
- name: Get android version
run: dotnet tool run ezpipeline git-height-version -- -v ANDROID_VERSION
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.BUILD_VERSION }}
tag_name: v${{ env.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
outputs:
BUILD_VERSION: ${{ env.BUILD_VERSION }}
ANDROID_VERSION: ${{ env.ANDROID_VERSION }}
# ---------------------------------------------------------------------------------------
build_desktop:
needs: set_version
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Evaluate target runtime
shell: bash
run: |
echo "OS: $OSTYPE"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "RUNTIME_ID: osx-x64"
echo "RUNTIME_ID=osx-x64" >> $GITHUB_ENV
elif [[ "$OSTYPE" == "linux"* ]]; then
echo "RUNTIME_ID: linux-x64"
echo "RUNTIME_ID=linux-x64" >> $GITHUB_ENV
elif [[ "$OSTYPE" == "msys"* ]]; then
echo "RUNTIME_ID: win-x64"
echo "RUNTIME_ID=win-x64" >> $GITHUB_ENV
else
echo "Unrecognized OS type $OSTYPE"
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore tools
run: dotnet tool restore
- name: Restore dependencies
working-directory: ./RbfxTemplate.Desktop
run: dotnet restore
- name: Dotnet Publish
working-directory: ./RbfxTemplate.Desktop
run: dotnet publish -f net8.0 -c Release --runtime ${{ env.RUNTIME_ID }} --self-contained true -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
- name: Copy runtime dlls
if: ${{ env.RUNTIME_ID == 'win-x64' }}
run: |
copy "C:/Windows/System32/MSVCP140.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/VCRUNTIME140.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/VCRUNTIME140_1.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/D3DCOMPILER_47.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
- name: Zip Package
run: dotnet tool run ezpipeline -- zip -i RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/ -o RbfxTemplate.${{ env.RUNTIME_ID }}.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./RbfxTemplate.${{ env.RUNTIME_ID }}.zip
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Release to itch.io ${{ vars.ITCH_PROJECT }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: ${{ env.BUTLER_API_KEY != '' && vars.ITCH_PROJECT != '' }}
run: |
dotnet tool run ezpipeline -- fetch-tool --name Butler -o tools/itch
tools/itch/butler push RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/ ${{ vars.ITCH_PROJECT }}:${{ env.RUNTIME_ID }}
shell: bash
# ---------------------------------------------------------------------------------------
build_android:
needs: set_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore tools
run: dotnet tool restore
- name: Install Workloads
run: dotnet workload install android
- name: Restore dependencies
working-directory: ./RbfxTemplate.Android
run: dotnet restore
- name: Install android-sdk
shell: bash
run: |
sudo apt-get install -y wget tar android-sdk unzip tree
echo $ANDROID_HOME
sudo chmod -R a+rw $ANDROID_HOME
- name: Fetch AndroidSDKManager
run: |
dotnet tool run ezpipeline fetch-tool -n AndroidSDKManager --output $ANDROID_HOME --path --version 9123335
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses --sdk_root=$ANDROID_HOME
- name: 'Print Java version'
run: javac -version
- name: Install Android SDK and Platforms
run: $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platform-tools" "platforms;android-33" --sdk_root=$ANDROID_HOME
- name: Dotnet Publish
working-directory: ./RbfxTemplate.Android
run: dotnet publish -f net8.0-android -c Release --no-restore -p:AndroidVersionCode=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
- name: Find APK
run: |
dotnet tool run ezpipeline resolve-path -i ./RbfxTemplate.Android/bin/Release/**/*-Signed.apk -v APK_PATH
dotnet tool run ezpipeline resolve-path -i ./RbfxTemplate.Android/bin/Release/**/*-Signed.aab -v AAB_PATH
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.APK_PATH }}
${{ env.AAB_PATH }}
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Release to itch.io ${{ vars.ITCH_PROJECT }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: ${{ env.BUTLER_API_KEY != '' && vars.ITCH_PROJECT != '' }}
run: |
dotnet tool run ezpipeline -- fetch-tool --name Butler -o tools/itch
tools/itch/butler push ${{ env.APK_PATH }} ${{ vars.ITCH_PROJECT }}:android
shell: bash
# ---------------------------------------------------------------------------------------
build_uwp:
needs: set_version
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Restore tools
run: dotnet tool restore
- name: Restore application
working-directory: ./RbfxTemplate.UWP
run: msbuild RbfxTemplate.UWP.csproj /t:Restore /p:Configuration=Release
- name: Patch manifest version
working-directory: ./RbfxTemplate.UWP
run: dotnet tool run ezpipeline -- set-xml -i Package.appxmanifest -p default:Package/default:Identity -a Version -v ${{ needs.set_version.outputs.BUILD_VERSION }}.0
- name: Dotnet Publish
working-directory: ./RbfxTemplate.UWP
run: msbuild RbfxTemplate.UWP.csproj /p:AppxPackageDir=appxupload /p:AppxBundle=Always /p:AppxBundlePlatforms="x64" /p:Platform=x64 /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=StoreUpload /p:Configuration=Release /p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
- name: Zip Package
run: dotnet tool run ezpipeline -- zip -i RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP_${{ needs.set_version.outputs.BUILD_VERSION }}.0_Test -o RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP.x64.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP_${{ needs.set_version.outputs.BUILD_VERSION }}.0_x64_bundle.appxupload
RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP.x64.zip
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}