-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (167 loc) · 5.54 KB
/
Copy pathrelease.yaml
File metadata and controls
188 lines (167 loc) · 5.54 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
name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: "Tag for which to build the app"
required: true
env:
# update with the name of the main binary
binary: 'amazons'
jobs:
# Build for Linux
release-linux-and-windows:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.tag == '' }}
steps:
- uses: little-core-labs/get-git-tag@v3.0.2
id: get_version
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Rust toolchain for linux
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
override: true
- name: Get dependencies
run: |
sudo apt update
sudo apt install libxcb-shape0-dev libxcb-xfixes0-dev
sudo apt install gcc-mingw-w64-x86-64-win32 gcc-mingw-w64-i686-win32
## Linux build
- name: Build backend for linux
run: |
cd Amazons
make lib
cd ..
- name: Build frontend for linux
run: |
cargo build --release --target x86_64-unknown-linux-gnu
- name: Prepare package for linux
run: |
mkdir linux
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/
- name: Package as a zip for linux
uses: vimtor/action-zip@v1
with:
files: linux
dest: ${{ env.binary }}.zip
- name: Upload binaries to release for linux
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: ${{ env.binary }}-linux-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
## 64 bit windows build
- name: Setup Rust toolchain for windows (64)
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-pc-windows-gnu
override: true
- name: Build backend for windows (64)
run: |
cd Amazons
make clean
make CC=/usr/bin/x86_64-w64-mingw32-gcc-win32 lib
cd ..
- name: Build frontend for windows (64)
run: |
cargo build --release --target x86_64-pc-windows-gnu
- name: Prepare package for windows (64)
run: |
mkdir windows64
cp target/x86_64-pc-windows-gnu/release/${{ env.binary }}.exe windows64/
- name: Package as a zip
uses: vimtor/action-zip@v1
with:
files: windows64
dest: ${{ env.binary }}.zip
- name: Upload binaries to release for windows (64)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: ${{ env.binary }}-windows-64bit-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
## 32 bit windows build
- name: Setup Rust toolchain for windows (32)
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: i686-pc-windows-gnu
override: true
- name: Build backend for windows (32)
run: |
cd Amazons
make clean
make CC=/usr/bin/i686-w64-mingw32-gcc-win32 lib
cd ..
- name: Build frontend for windows (32)
run: |
cargo build --release --target i686-pc-windows-gnu
- name: Prepare package for windows (32)
run: |
mkdir windows32
cp target/i686-pc-windows-gnu/release/${{ env.binary }}.exe windows32/
- name: Package as a zip
uses: vimtor/action-zip@v1
with:
files: windows32
dest: ${{ env.binary }}.zip
- name: Upload binaries to release for windows (32)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: ${{ env.binary }}-windows-32bit-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
# Build for macOS
release-macos:
runs-on: macOS-latest
if: ${{ github.event.inputs.tag == '' }}
steps:
- uses: little-core-labs/get-git-tag@v3.0.2
id: get_version
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
override: true
- name: Environment Setup
run: |
export CFLAGS="-fno-stack-check"
export MACOSX_DEPLOYMENT_TARGET="10.9"
- name: Build backend
run: |
cd Amazons
make lib
cd ..
- name: Build
run: |
cargo build --release --target x86_64-apple-darwin
- name: Prepare Package
run: |
mkdir -p ${{ env.binary }}.app/Contents/MacOS
cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}.dmg
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.dmg
asset_name: ${{ env.binary }}-macos-${{ steps.get_version.outputs.tag }}.dmg
tag: ${{ github.ref }}
overwrite: true