Skip to content

Commit 5b95ed0

Browse files
committed
Restructure macOS packaging to hopefully make it work correctly
1 parent d1383bc commit 5b95ed0

3 files changed

Lines changed: 41 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ jobs:
6464
cache: 'pnpm'
6565
cache-dependency-path: './frontend/pnpm-lock.yaml'
6666

67+
# Get the version from the common/.version file and set it as an environment variable
68+
- name: Set SPINUP_VERSION
69+
id: get_version
70+
run: echo "SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')" >> $GITHUB_ENV
71+
shell: bash
72+
6773
# install Wails
6874
- name: Install Wails
6975
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
@@ -87,29 +93,26 @@ jobs:
8793
if: runner.os == 'Linux'
8894
working-directory: ${{ env.WORKING_DIRECTORY }}
8995
run: |
90-
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
91-
sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak
96+
sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak
9297
93-
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION} -tags webkit2_40
94-
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION}-ubuntu24.04 -tags webkit2_41
98+
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }} -tags webkit2_40
99+
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }}-ubuntu24.04 -tags webkit2_41
95100
shell: bash
96101
- name: Build macOs App
97102
if: runner.os == 'macOS'
98103
working-directory: ${{ env.WORKING_DIRECTORY }}
99104
run: |
100-
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
101-
sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak
105+
sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak
102106
103107
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}
104108
shell: bash
105109
- name: Build Windows App + Installer
106110
if: runner.os == 'Windows'
107111
working-directory: ${{ env.WORKING_DIRECTORY }}
108112
run: |
109-
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
110-
sed -i "s/{{version}}/${SPINUP_VERSION}/g" wails.json
113+
sed -i "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json
111114
112-
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${SPINUP_VERSION}
115+
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }}
113116
shell: bash
114117

115118
# Add permissions to the binary
@@ -160,6 +163,16 @@ jobs:
160163
working-directory: ${{ env.WORKING_DIRECTORY }}
161164
run: bash ./scripts/release/package-rpm.sh
162165

166+
# Check if macOS zip installs correctly
167+
- name: Check if macOS zip installs correctly
168+
if: runner.os == 'macOS'
169+
working-directory: ${{ env.WORKING_DIRECTORY }}
170+
run: |
171+
unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup
172+
cd /tmp/spinup/
173+
sudo ./install.sh
174+
shell: bash
175+
163176
# Upload build assets
164177
- uses: actions/upload-artifact@v4
165178
with:
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ SPINUP_SHARE_DIR="/usr/local/share/spinup"
4545
### General setup ###
4646
#####################
4747

48+
# Copy over the /usr/local/share/spinup directory to the correct location
49+
cp -r ./usr/local/share/spinup /usr/local/share
50+
4851
# Remove the old symlink if it exists and create a new one
4952
rm -f /usr/local/bin/spinup
5053
ln -s $SPINUP_SHARE_DIR/bin/spinup /usr/local/bin/spinup
@@ -111,10 +114,12 @@ if ! grep -q "^@includedir /etc/sudoers.d[[:space:]]*$" /etc/sudoers; then
111114
echo "@includedir /etc/sudoers.d" | visudo -c -f - &>/dev/null && echo "@includedir /etc/sudoers.d" | EDITOR='tee -a' visudo &>/dev/null
112115
fi
113116

114-
# Move the spinup sudoers file to the sudoers.d directory
115-
mv $SPINUP_SHARE_DIR/config/sudoers /etc/sudoers.d/spinup
116-
chmod 440 /etc/sudoers.d/spinup
117-
chown root:wheel /etc/sudoers.d/spinup
117+
SUDOERS_FILE=/etc/sudoers.d/spinup
118+
119+
# Move the spinup sudoers file to the /etc/sudoers.d directory
120+
mv .$SUDOERS_FILE $SUDOERS_FILE
121+
chmod 440 $SUDOERS_FILE
122+
chown root:wheel $SUDOERS_FILE
118123

119124
# Set the correct permissions on the user's spinup .config directory
120125
chown -R $SUDO_USER:staff $USER_HOME/.config/spinup

scripts/release/package-macos-zip.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@
22

33
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
44

5-
MAC_OS_DIR="./build/macos"
5+
MAC_OS_DIR="./packaging/macos"
6+
SPINUP_SHARE_DIR="/usr/local/share/spinup"
67

78
# Define the path to the binary file
89
BIN_FILE="./build/bin/Spinup.app/Contents/MacOS/spinup"
910

1011
# Create the mac os directory
1112
mkdir -p $MAC_OS_DIR
1213

14+
# Create the MacOS directory structure
15+
mkdir -p "$MAC_OS_DIR/etc"
16+
mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR"
17+
1318
# Copy the contents of the build/unix directory to the MacOS directory
14-
cp -r "./build/unix/." $MAC_OS_DIR
19+
cp -r "./packaging/unix/etc/." $MAC_OS_DIR/etc
20+
cp -r "./packaging/unix/usr/share/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR
1521

1622
# Copy the binary file to the MacOS directory
17-
mkdir -p "$MAC_OS_DIR/usr/share/spinup/bin"
18-
cp $BIN_FILE "$MAC_OS_DIR/usr/share/spinup/bin"
19-
20-
# Move the sudoers file to the config directory
21-
mv "$MAC_OS_DIR/etc/sudoers.d/spinup" "$MAC_OS_DIR/usr/share/spinup/config/sudoers"
23+
mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"
24+
cp $BIN_FILE "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"
2225

2326
# Create a zip file containing the contents of the MacOS directory
2427
(cd $MAC_OS_DIR && zip -r "../../spinup-${SPINUP_VERSION}-macos.zip" .)

0 commit comments

Comments
 (0)