-
Notifications
You must be signed in to change notification settings - Fork 5
232 lines (191 loc) · 6.38 KB
/
build.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: "Build and release binary"
on:
workflow_dispatch:
push:
tags:
- "misrc_extract-*"
env:
ARCHIVE_NAME_LINUX: ${{ github.ref_name }}-linux-x86_64.tar.gz
ARCHIVE_NAME_WINDOWS: ${{ github.ref_name }}-win-x86_64.zip
ARCHIVE_NAME_MACOS_INTEL: ${{ github.ref_name }}-macos-intel-x86_64.tar.gz
ARCHIVE_NAME_MACOS_ARM: ${{ github.ref_name }}-macos-apple-silicon-arm64.tar.gz
ARCHIVE_NAME_SRC: ${{ github.ref_name }}-src.tar.gz
jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake nasm build-essential
version: 1.0
- name: Build
run: |
cmake -B ${{ github.workspace }}/misrc_extract/build \
${{ github.workspace }}/misrc_extract
cmake --build ${{ github.workspace }}/misrc_extract/build
- name: Create binary archive
run: >-
tar -cvzf ${{ env.ARCHIVE_NAME_LINUX }}
--owner=root --group=root
-C ${{ github.workspace }}/misrc_extract/build
misrc_extract
- name: Create source archive
run: >-
tar -cvzf ${{ env.ARCHIVE_NAME_SRC }}
--exclude=build
misrc_extract
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: misrc_extract-linux
path: ${{ env.ARCHIVE_NAME_LINUX }}
if-no-files-found: error
- name: Upload source artifact
uses: actions/upload-artifact@v4
with:
name: misrc_extract-src
path: ${{ env.ARCHIVE_NAME_SRC }}
if-no-files-found: error
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install winget
uses: Cyberboss/install-winget@v1
- name: Install MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Install NASM
run: >-
winget install
--disable-interactivity
--accept-source-agreements
--accept-package-agreements
--silent --exact --id NASM.NASM
- name: Build
run: |
cmake -B ${{ github.workspace }}\misrc_extract/build `
${{ github.workspace }}\misrc_extract
cmake --build ${{ github.workspace }}\misrc_extract/build --config Release
- name: Create binary archive
run: >-
Compress-Archive `
-Path ${{ github.workspace }}\misrc_extract\build\Release\misrc_extract.exe `
${{ env.ARCHIVE_NAME_WINDOWS }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: misrc_extract-windows
path: ${{ env.ARCHIVE_NAME_WINDOWS }}
if-no-files-found: error
build-macos-intel:
name: Build macOS (Intel)
runs-on: macos-11
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install
run: |
brew install cmake nasm
- name: Build
run: |
cmake -B ${{ github.workspace }}/misrc_extract/build \
${{ github.workspace }}/misrc_extract
cmake --build ${{ github.workspace }}/misrc_extract/build
- name: Create binary archive
run: >-
tar -cvzf ${{ env.ARCHIVE_NAME_MACOS_INTEL }}
--uid 0 --gid 0 --no-acls
-C ${{ github.workspace }}/misrc_extract/build
misrc_extract
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: misrc_extract-macos-intel
path: ${{ env.ARCHIVE_NAME_MACOS_INTEL }}
if-no-files-found: error
build-macos-arm:
name: Build macOS (Apple Silicon)
runs-on: macos-11
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install
run: |
brew install cmake
- name: Build
run: |
cmake -B ${{ github.workspace }}/misrc_extract/build \
${{ github.workspace }}/misrc_extract \
-D CMAKE_OSX_ARCHITECTURES=arm64
cmake --build ${{ github.workspace }}/misrc_extract/build
- name: Create binary archive
run: >-
tar -cvzf ${{ env.ARCHIVE_NAME_MACOS_ARM }}
--uid 0 --gid 0 --no-acls
-C ${{ github.workspace }}/misrc_extract/build
misrc_extract
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: misrc_extract-macos-arm
path: ${{ env.ARCHIVE_NAME_MACOS_ARM }}
if-no-files-found: error
github-release:
name: Create GitHub release
runs-on: ubuntu-20.04
needs:
- build-linux
- build-windows
- build-macos-intel
- build-macos-arm
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--title '${{ github.ref_name }}'
--notes ""
- name: Upload artifacts to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload \
'${{ github.ref_name }}' \
'misrc_extract-linux/${{ env.ARCHIVE_NAME_LINUX }}' \
--repo '${{ github.repository }}'
gh release upload \
'${{ github.ref_name }}' \
'misrc_extract-windows/${{ env.ARCHIVE_NAME_WINDOWS }}' \
--repo '${{ github.repository }}'
gh release upload \
'${{ github.ref_name }}' \
'misrc_extract-macos-intel/${{ env.ARCHIVE_NAME_MACOS_INTEL }}' \
--repo '${{ github.repository }}'
gh release upload \
'${{ github.ref_name }}' \
'misrc_extract-macos-arm/${{ env.ARCHIVE_NAME_MACOS_ARM }}' \
--repo '${{ github.repository }}'
gh release upload \
'${{ github.ref_name }}' \
'misrc_extract-src/${{ env.ARCHIVE_NAME_SRC }}' \
--repo '${{ github.repository }}'