Skip to content

Commit 589f041

Browse files
committed
Add macOS workflow
1 parent b8d8f2a commit 589f041

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

.ci/macos_build.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
.ci/common/build.sh macos || exit $?
4+
mv $(find . -name "${executable_name}.app") . || exit $?
5+
6+
mkdir -p "${executable_name}.app/Contents/Frameworks"
7+
8+
for file in $(find . -type f -name "*.dylib"); do
9+
install_name_tool -change "$file" "@rpath/$file" "${executable_name}.app/Contents/MacOS/${executable_name}" || exit $?
10+
cp "$file" "${executable_name}.app/Contents/Frameworks/"
11+
done
12+
13+
macdeployqt "${executable_name}.app" -qmldir=src || exit $?
14+
15+
# Sign using self-signed certificate
16+
codesign --verify --verbose --force --deep -s - "${executable_name}.app"
17+
codesign --verify --verbose "${executable_name}.app"
18+
19+
# Create .dmg with an install screen
20+
npm install -g appdmg || exit $?
21+
mv ${executable_name}.app res/macos-release/
22+
dmg_name=`echo "${app_name}.dmg" | tr ' ' '_'`
23+
appdmg res/macos-release/scratchcpp-player.json "$dmg_name" || exit $?
24+
25+
# Verify
26+
spctl -a -t open --context context:primary-signature -v "$dmg_name"

.github/workflows/macos-build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: macOS Build
2+
3+
on:
4+
push:
5+
branches: '*'
6+
tags: '*'
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
runs-on: macos-14
13+
strategy:
14+
matrix:
15+
os: [macos-14]
16+
qt-version: ['6.8']
17+
qt-target: ['desktop']
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
submodules: 'recursive'
23+
- name: Setup environment
24+
run: |
25+
sed -i -e '/^#/d' .github/config.env
26+
sed -i -e '/^$/d' .github/config.env
27+
cat .github/config.env >> "${GITHUB_ENV}"
28+
shell: bash
29+
- name: Set up node.js
30+
uses: actions/setup-node@v3
31+
# Install Qt
32+
- name: Install Qt
33+
uses: jurplel/install-qt-action@v3
34+
with:
35+
version: ${{ matrix.qt-version }}
36+
host: 'mac'
37+
target: ${{ matrix.qt-target }}
38+
modules: ''
39+
# Build
40+
- name: Build
41+
run: .ci/macos_build.sh
42+
shell: bash
43+
# Upload
44+
- name: Upload artifacts
45+
uses: actions/upload-artifact@v3
46+
with:
47+
name: build-Qt-${{ matrix.qt-version }}
48+
path: '*.dmg'

res/macos-release/bg.png

12.1 KB
Loading
47.4 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"title": "ScratchCPP Player",
3+
"icon": "scratchcpp-player.icns",
4+
"background": "bg.png",
5+
"contents": [
6+
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
7+
{ "x": 192, "y": 344, "type": "file", "path": "scratchcpp-player.app" }
8+
]
9+
}

0 commit comments

Comments
 (0)