Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ jobs:
cache: 'pnpm'
cache-dependency-path: './frontend/pnpm-lock.yaml'

# Get the version from the common/.version file and set it as an environment variable
- name: Set SPINUP_VERSION
id: get_version
run: echo "SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')" >> $GITHUB_ENV
shell: bash

# install Wails
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
Expand All @@ -87,29 +93,26 @@ jobs:
if: runner.os == 'Linux'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak
sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak

wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION} -tags webkit2_40
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION}-ubuntu24.04 -tags webkit2_41
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }} -tags webkit2_40
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }}-ubuntu24.04 -tags webkit2_41
shell: bash
- name: Build macOs App
if: runner.os == 'macOS'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak
sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak

wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}
shell: bash
- name: Build Windows App + Installer
if: runner.os == 'Windows'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
sed -i "s/{{version}}/${SPINUP_VERSION}/g" wails.json
sed -i "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json

wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${SPINUP_VERSION}
wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }}
shell: bash

# Add permissions to the binary
Expand All @@ -133,8 +136,8 @@ jobs:
with:
key: ${{ runner.os }}-icons-${{ hashFiles('images/icon-large.png') }}
path: |
build/unix/usr/share/icons
build/unix/usr/share/pixmaps
packaging/unix/usr/share/icons
packaging/unix/usr/share/pixmaps
- name: Generate icons
# if: (runner.os == 'Linux' || runner.os == 'macOS') && steps.cache-icons.outputs.cache-hit != 'true'
if: runner.os == 'Linux' && steps.cache-icons.outputs.cache-hit != 'true'
Expand All @@ -160,6 +163,28 @@ jobs:
working-directory: ${{ env.WORKING_DIRECTORY }}
run: bash ./scripts/release/package-rpm.sh

# Check if Ubuntu deb installs correctly
- name: Check if Ubuntu deb installs correctly
if: runner.os == 'Linux'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.1-dev nginx dnsmasq
sudo dpkg -i ./deb/spinup-${{ env.SPINUP_VERSION }}-ubuntu24.04.deb
spinup --version
shell: bash

# Check if macOS zip installs correctly
- name: Check if macOS zip installs correctly
if: runner.os == 'macOS'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
brew install nginx dnsmasq
unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup
cd /tmp/spinup/
sudo bash ./install.sh
spinup --version
shell: bash

# Upload build assets
- uses: actions/upload-artifact@v4
with:
Expand Down
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ Quickly spin up your multi command projects.

To install the required packages on a debian based system you can use the following command:
```bash
sudo apt install nginx dnsmasq
sudo apt install libgtk-3-0 libwebkit2gtk-4.0-dev nginx dnsmasq
```

Download a `.deb` package from the releases. There is a separate version for Ubuntu 24.04 since it uses a different version of the `libwebkit2gtk` package.
> **Note**
>
> For Ubuntu 24.04 and up, you should install `libwebkit2gtk-4.1-dev` instead of `libwebkit2gtk-4.0-dev`.

Download the `.deb` package from the releases. There is a separate version for Ubuntu 24.04 due to the different `libwebkit2gtk` package version being used.

To install the package run the following command where `{{version}}` is the version of the package:
```bash
Expand Down Expand Up @@ -59,19 +63,9 @@ Download the `spinup-{{version}}-macos.zip` archive from the releases and unzip
unzip spinup-{{version}}-macos.zip
```

Then move the `usr/share/spinup` folder to `/usr/share/spinup`:
```bash
sudo mv -R ./spinup-{{version}}-macos/usr/share/spinup /usr/share
```

The same for the sudoers file:
```bash
sudo mv -R ./spinup-{{version}}-macos/etc/sudoers.d/spinup /etc/sudoers.d/spinup
```

To complete the installation run the post install script:
Run the installation script:
```bash
sudo ./spinup-{{version}}-macos/postinstall.sh
sudo ./spinup-{{version}}-macos/install.sh
```

This will create the required directories and files.
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions build/DEBIAN/postinst → packaging/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ fi
if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then
# Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist
ln -s /usr/share/spinup/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf

# Restart the dnsmasq service
systemctl restart dnsmasq
fi

#############
Expand All @@ -53,6 +50,7 @@ SPINUP_NGINX_DIR="/usr/share/spinup/config/nginx"

# Create the user's spinup nginx directory if it doesn't exist
mkdir -p $USER_SPINUP_NGINX_DIR
chown -R $SUDO_USER:$SUDO_USER $USER_HOME/.config/spinup

if [ ! -d $SPINUP_NGINX_DIR ]; then
# Link the user's spinup nginx directory to the spinup config directory if it doesn't exist
Expand Down
File renamed without changes.
107 changes: 107 additions & 0 deletions packaging/macos/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env bash

# Make sure the script is being run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" >&2
exit 1
fi

# Check if the SUDO_USER environment variable is set
if [ -z "$SUDO_USER" ]; then
echo "The SUDO_USER environment variable is not set" >&2
exit 1
fi

# Get the home directory of the user that ran the script
USER_HOME="/Users/$SUDO_USER"

# Make sure the user's home directory exists
if [ ! -d "$USER_HOME" ]; then
echo "The user's home directory does not exist" >&2
exit 1
fi

SPINUP_SHARE_DIR="/usr/local/share/spinup"

#####################
### General setup ###
#####################

# Copy over the /usr/local/share/spinup directory to the correct location
cp -r ./usr/local/share/spinup /usr/local/share

# Remove the old symlink if it exists and create a new one
rm -f /usr/local/bin/spinup
ln -s $SPINUP_SHARE_DIR/bin/spinup /usr/local/bin/spinup

# Set the correct permissions on the spinup directory
chown -R root:wheel $SPINUP_SHARE_DIR

###############
### Dnsmasq ###
###############

if [ ! -d /etc/dnsmasq.d ]; then
# Create the dnsmasq.d directory if it doesn't exist
mkdir /etc/dnsmasq.d
fi

# Check if the spinup.conf already exists in the dnsmasq.d directory
if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then
# Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist
ln -s $SPINUP_SHARE_DIR/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf

# Restart the dnsmasq service
brew services restart dnsmasq
fi

#############
### Nginx ###
#############

USER_SPINUP_NGINX_DIR="$USER_HOME/.config/spinup/nginx"
SPINUP_NGINX_DIR="/usr/local/share/spinup/config/nginx"
BREW_NGINX_DIR="/opt/homebrew/etc/nginx"

# Create the user's spinup nginx directory if it doesn't exist
mkdir -p $USER_SPINUP_NGINX_DIR

if [ ! -d $SPINUP_NGINX_DIR ]; then
# Link the user's spinup nginx directory to the spinup config directory if it doesn't exist
ln -s $USER_SPINUP_NGINX_DIR $SPINUP_NGINX_DIR
fi

# Add the user's spinup nginx directory to the nginx configuration
if ! grep -q "include ${SPINUP_NGINX_DIR}/\*.conf;" $BREW_NGINX_DIR/nginx.conf; then
# Make a backup of the nginx configuration file
cp $BREW_NGINX_DIR/nginx.conf $BREW_NGINX_DIR/nginx.conf.bak

# Add the include directive to the bottom of the http section in the nginx configuration file
sed -i '/http {/!b; :a; N; /}/!ba; s/}/\tinclude '"${SPINUP_NGINX_DIR//\//\\/}"'\/\*.conf;\n}/' $BREW_NGINX_DIR/nginx.conf
fi

# Restart the nginx service
brew services restart nginx

###############
### Sudoers ###
###############

# Add an include for the sudoers.d directory to the sudoers file if it doesn't already exist
if ! grep -q "^@includedir /etc/sudoers.d[[:space:]]*$" /etc/sudoers; then
# Make a backup of the sudoers file
cp /etc/sudoers /etc/sudoers.bak

# Add the include directive to the sudoers file
echo "@includedir /etc/sudoers.d" | visudo -c -f - &>/dev/null && echo "@includedir /etc/sudoers.d" | EDITOR='tee -a' visudo &>/dev/null
fi

SUDOERS_FILE=/etc/sudoers.d/spinup

# Move the spinup sudoers file to the /etc/sudoers.d directory
mv .$SUDOERS_FILE $SUDOERS_FILE
chmod 440 $SUDOERS_FILE
chown root:wheel $SUDOERS_FILE

# Set the correct permissions on the user's spinup .config directory
chown -R $SUDO_USER:staff $USER_HOME/.config/spinup
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/generate-icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SOURCE="./images/icon-large.png"
SIZES=(1024 512 256 128 64 32 16)
SHARE_DIR="./build/unix/usr/share"
SHARE_DIR="./packaging/unix/usr/share"
PIXMAPS_DIR="$SHARE_DIR/pixmaps"

mkdir -p $SHARE_DIR/icons/hicolor
Expand Down
10 changes: 5 additions & 5 deletions scripts/release/package-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ for os_version in "" "-ubuntu24.04"; do

# Copy the necessary files to the .deb package directory
cp build/bin/spinup-${SPINUP_VERSION}${os_version} deb/spinup-${SPINUP_VERSION}${os_version}/usr/share/spinup/bin/spinup
cp build/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN
cp -r build/unix/usr deb/spinup-${SPINUP_VERSION}${os_version}
cp packaging/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN
cp -r packaging/unix/usr deb/spinup-${SPINUP_VERSION}${os_version}

# Update the control file with the current version number
echo -e "\nVersion: $SPINUP_VERSION" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control

# Add the dependencies for the .deb package
if [ "$os_version" -eq "" ]; then
echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.0-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control
if [ "$os_version" = "" ]; then
echo "Depends: libgtk-3-0, libwebkit2gtk-4.0-dev, nginx, dnsmasq" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control
else
echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.1-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control
echo "Depends: libgtk-3-0, libwebkit2gtk-4.1-dev, nginx, dnsmasq" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control
fi

# Set the permissions for the .deb package files
Expand Down
18 changes: 10 additions & 8 deletions scripts/release/package-macos-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

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

MAC_OS_DIR="./build/macos"
MAC_OS_DIR="./packaging/macos"
SPINUP_SHARE_DIR="/usr/local/share/spinup"

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

# Create the mac os directory
mkdir -p $MAC_OS_DIR

# Create the MacOS directory structure
mkdir -p "$MAC_OS_DIR/etc"
mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR"

# Copy the contents of the build/unix directory to the MacOS directory
cp -r "./build/unix/." $MAC_OS_DIR
cp -r "./packaging/unix/etc/." $MAC_OS_DIR/etc
cp -r "./packaging/unix/usr/share/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR

# Copy the binary file to the MacOS directory
mkdir -p "$MAC_OS_DIR/usr/share/spinup/bin"
cp $BIN_FILE "$MAC_OS_DIR/usr/share/spinup/bin"

# Copy postinstall script to the MacOS directory
cp "./build/DEBIAN/postinst" $MAC_OS_DIR
mv "$MAC_OS_DIR/postinst" "$MAC_OS_DIR/postinstall.sh"
mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"
cp $BIN_FILE "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"

# Create a zip file containing the contents of the MacOS directory
(cd $MAC_OS_DIR && zip -r "../../spinup-${SPINUP_VERSION}-macos.zip" .)
10 changes: 5 additions & 5 deletions scripts/release/package-rpm.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/env bash

SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
SOURCES_DIR=./build/rpmbuild/SOURCES
SOURCES_DIR=./packaging/rpmbuild/SOURCES

# Add the version number to the spec file
sed -i "s/{{version}}/${SPINUP_VERSION}/g" build/rpmbuild/SPECS/spinup.spec
sed -i "s/{{version}}/${SPINUP_VERSION}/g" packaging/rpmbuild/SPECS/spinup.spec

# Create the directory structure for the .rpm package
mkdir -p $SOURCES_DIR/spinup-${SPINUP_VERSION}
cp build/bin/spinup-${SPINUP_VERSION} $SOURCES_DIR/spinup-${SPINUP_VERSION}/
mv $SOURCES_DIR/spinup-${SPINUP_VERSION}/spinup-${SPINUP_VERSION} $SOURCES_DIR/spinup-${SPINUP_VERSION}/spinup

# Add the contents of the build/unix directory to the rpm sources
cp -r build/unix/. $SOURCES_DIR/spinup-${SPINUP_VERSION}/
cp -r packaging/unix/. $SOURCES_DIR/spinup-${SPINUP_VERSION}/

# Add the postinstall script to the rpm sources
cp build/DEBIAN/postinst $SOURCES_DIR/spinup-${SPINUP_VERSION}/
cp packaging/DEBIAN/postinst $SOURCES_DIR/spinup-${SPINUP_VERSION}/

# Set the permissions for the .rpm package files
sudo chown -R root:root $SOURCES_DIR/spinup-${SPINUP_VERSION}
Expand All @@ -27,7 +27,7 @@ cd ../../..

# Remove the existing rpmbuild directory and copy the new one
rm -rf ~/rpmbuild
cp -r build/rpmbuild ~/
cp -r packaging/rpmbuild ~/

# Build the .rpm package
rpmbuild -bb ~/rpmbuild/SPECS/spinup.spec
Expand Down