Skip to content

Commit 3565cb3

Browse files
committed
Add release workflow
Closes #66
1 parent a3ed381 commit 3565cb3

2 files changed

Lines changed: 200 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
jobs:
13+
linux:
14+
name: Linux (${{ matrix.arch }})
15+
16+
runs-on: ubuntu-20.04
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
arch:
22+
- x86
23+
- x64
24+
25+
steps:
26+
- name: Clone
27+
uses: actions/checkout@v3
28+
29+
- name: Dependencies (x86)
30+
if: matrix.arch == 'x86'
31+
run: |
32+
sudo dpkg --add-architecture i386
33+
sudo apt update
34+
sudo apt install --allow-downgrades libpcre2-8-0=10.34-7
35+
sudo apt install g++-multilib libsdl2-dev:i386 zlib1g-dev:i386
36+
37+
- name: Dependencies (x64)
38+
if: matrix.arch == 'x64'
39+
run: |
40+
sudo apt update
41+
sudo apt install libsdl2-dev zlib1g-dev
42+
43+
- name: Cache cmake build
44+
uses: actions/cache@v3
45+
with:
46+
path: build
47+
key: linux-${{ matrix.arch }}-cmake-v1
48+
49+
- name: Configure (x86)
50+
if: matrix.arch == 'x86'
51+
run: |
52+
cmake \
53+
-B build \
54+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
55+
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/Linux32.cmake \
56+
# EOL
57+
58+
- name: Configure (x64)
59+
if: matrix.arch == 'x64'
60+
run: |
61+
cmake \
62+
-B build \
63+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
64+
# EOL
65+
66+
- name: Build
67+
run: |
68+
cmake --build build -j $(nproc)
69+
70+
- name: Upload
71+
run: |
72+
cd build
73+
tar -czvf fallout2-ce-linux-${{ matrix.arch }}.tar.gz fallout2-ce
74+
gh release upload ${{ github.ref_name }} fallout2-ce-linux-${{ matrix.arch }}.tar.gz
75+
rm fallout2-ce-linux-${{ matrix.arch }}.tar.gz
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
79+
macos:
80+
name: macOS
81+
82+
runs-on: macos-11
83+
84+
steps:
85+
- name: Clone
86+
uses: actions/checkout@v3
87+
88+
- name: Dependencies
89+
run: |
90+
brew install sdl2
91+
92+
- name: Import code signing certificates
93+
uses: apple-actions/import-codesign-certs@v1
94+
with:
95+
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_FILE_BASE64 }}
96+
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_PASSWORD }}
97+
98+
- name: Cache cmake build
99+
uses: actions/cache@v3
100+
with:
101+
path: build
102+
key: macos-cmake-v1
103+
104+
- name: Configure
105+
run: |
106+
cmake \
107+
-B build \
108+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
109+
-D CPACK_BUNDLE_APPLE_CERT_APP="${{ secrets.APPLE_DEVELOPER_CERTIFICATE_IDENTITY }}" \
110+
# EOL
111+
112+
- name: Build
113+
run: |
114+
cmake \
115+
--build build \
116+
-j $(sysctl -n hw.physicalcpu) \
117+
--target package \
118+
# EOL
119+
120+
- name: Notarize
121+
run: |
122+
brew install mitchellh/gon/gon
123+
cat << EOF > config.json
124+
{
125+
"notarize": {
126+
"path": "build/fallout2-ce.dmg",
127+
"bundle_id": "$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" build/fallout2-ce.app/Contents/Info.plist)",
128+
"staple": true
129+
}
130+
}
131+
EOF
132+
gon config.json
133+
rm config.json
134+
env:
135+
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_AC_USERNAME }}
136+
AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_AC_PASSWORD }}
137+
138+
- name: Upload
139+
run: |
140+
cd build
141+
cp fallout2-ce.dmg fallout2-ce-macos.dmg
142+
gh release upload ${{ github.ref_name }} fallout2-ce-macos.dmg
143+
rm fallout2-ce-macos.dmg
144+
env:
145+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
147+
windows:
148+
name: Windows (${{ matrix.arch }})
149+
150+
runs-on: windows-2019
151+
152+
strategy:
153+
fail-fast: false
154+
matrix:
155+
include:
156+
- arch: x86
157+
generator-platform: Win32
158+
- arch: x64
159+
generator-platform: x64
160+
161+
steps:
162+
- name: Clone
163+
uses: actions/checkout@v3
164+
165+
- name: Cache cmake build
166+
uses: actions/cache@v3
167+
with:
168+
path: build
169+
key: windows-${{ matrix.arch }}-cmake-v1
170+
171+
- name: Configure
172+
run: |
173+
cmake \
174+
-B build \
175+
-G "Visual Studio 16 2019" \
176+
-A ${{ matrix.generator-platform }} \
177+
# EOL
178+
179+
- name: Build
180+
run: |
181+
cmake \
182+
--build build \
183+
--config RelWithDebInfo \
184+
# EOL
185+
186+
- name: Upload
187+
run: |
188+
cd build/RelWithDebInfo
189+
7z a fallout2-ce-windows-${{ matrix.arch }}.zip fallout2-ce.exe
190+
gh release upload ${{ github.ref_name }} fallout2-ce-windows-${{ matrix.arch }}.zip
191+
rm fallout2-ce-windows-${{ matrix.arch }}.zip
192+
env:
193+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ if(APPLE)
297297
"
298298
COMPONENT Runtime)
299299

300+
if (CPACK_BUNDLE_APPLE_CERT_APP)
301+
install(CODE "
302+
execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app)
303+
"
304+
COMPONENT Runtime)
305+
endif()
306+
300307
set(CPACK_GENERATOR "DragNDrop")
301308
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
302309
set(CPACK_PACKAGE_FILE_NAME "fallout2-ce")

0 commit comments

Comments
 (0)