-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (178 loc) · 7.13 KB
/
release.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
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
env:
EXECUTABLE_NAME: soukoban-rs
OSX_APP_NAME: Sokoban
permissions:
contents: write
jobs:
get-tag:
runs-on: ubuntu-latest
steps:
- name: Get tag
id: get-tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
build-windows:
runs-on: windows-latest
needs: get-tag
env:
TAG: ${{ needs.get-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
- name: Pack
uses: vimtor/action-zip@v1
with:
files: assets target/release/${{ env.EXECUTABLE_NAME }}.exe
dest: sokoban-windows.zip
- name: Upload artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sokoban-windows.zip
asset_name: sokoban-windows.zip
tag: ${{ env.TAG }}
overwrite: true
# - name: Create installer
# run: |
# set VERSION=
# dotnet build -p:Version=${{ env.TAG }} -c Release build/windows/installer/Installer.wixproj --output installer
# - name: Upload artifact to release
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: installer/en-US/installer.msi
# asset_name: sokoban-windows.msi
# tag: ${{ env.TAG }}
# overwrite: true
build-linux:
runs-on: ubuntu-latest
needs: get-tag
env:
TAG: ${{ needs.get-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Build
run: cargo build --release
- name: Pack
run: |
chmod +x target/release/${{ env.EXECUTABLE_NAME }}
mv target/release/${{ env.EXECUTABLE_NAME }} .
tar -czf sokoban-linux.tar.gz ${{ env.EXECUTABLE_NAME }} assets
- name: Upload artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sokoban-linux.tar.gz
asset_name: sokoban-linux.tar.gz
release_name: ${{ env.TAG }}
tag: ${{ env.TAG }}
overwrite: true
build-macos:
runs-on: macos-latest
needs: get-tag
env:
TAG: ${{ needs.get-tag.outputs.tag }}
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: Build (ARM)
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) cargo build --release --target=aarch64-apple-darwin
- name: Build (x64)
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) cargo build --release --target=x86_64-apple-darwin
- name: Create universal binary
run: lipo -create -output target/release/${{ env.EXECUTABLE_NAME }} target/aarch64-apple-darwin/release/${{ env.EXECUTABLE_NAME }} target/x86_64-apple-darwin/release/${{ env.EXECUTABLE_NAME }}
- name: Pack
run: |
mkdir -p build/macos/src/Game.app/Contents/MacOS/assets
cp -r assets/ build/macos/src/Game.app/Contents/MacOS/assets
cp target/release/${{ env.EXECUTABLE_NAME }} build/macos/src/Game.app/Contents/MacOS/
mv build/macos/src/Game.app build/macos/src/${{ env.OSX_APP_NAME }}.app
ln -s /Applications build/macos/src/
hdiutil create -fs HFS+ -volname "${{ env.OSX_APP_NAME }}" -srcfolder build/macos/src sokoban-macos.dmg
- name: Upload artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sokoban-macos.dmg
asset_name: sokoban-macos.dmg
release_name: ${{ env.TAG }}
tag: ${{ env.TAG }}
overwrite: true
build-android:
runs-on: ubuntu-latest
needs: get-tag
env:
TAG: ${{ needs.get-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Add rustup target(s)
run: rustup target add aarch64-linux-android
- name: Install cargo-apk
run: cargo install --force cargo-apk
- name: Build
# Uses a debug build, since release builds require keystore configuration
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package mobile
- name: Upload artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/debug/apk/sokoban-rs.apk
asset_name: sokoban-android.apk
release_name: ${{ env.TAG }}
tag: ${{ env.TAG }}
overwrite: true
build-wasm:
runs-on: ubuntu-latest
needs: get-tag
env:
TAG: ${{ needs.get-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/[email protected]
with:
version: latest
- name: Add rustup target(s)
run: rustup target add wasm32-unknown-unknown
- name: Build
run: trunk build --release
- name: Optimize
uses: NiklasEi/wasm-opt-action@v2
with:
file: dist/*.wasm
- name: Pack
uses: vimtor/action-zip@v1
with:
files: dist/
dest: sokoban-wasm.zip
- name: Upload artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sokoban-wasm.zip
asset_name: sokoban-wasm.zip
release_name: ${{ env.TAG }}
tag: ${{ env.TAG }}
overwrite: true