FreeDATA/.github/workflows/build_appimage_bundle.yml

127 lines
4.1 KiB
YAML
Raw Normal View History

2024-03-11 09:42:24 +00:00
name: Build and Release APPIMAGE Installer
on: [push]
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
2024-04-18 12:46:13 +00:00
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: 20
2024-03-11 09:42:24 +00:00
- name: Electron Builder
2024-04-18 09:04:25 +00:00
working-directory: freedata_gui
2024-03-11 09:42:24 +00:00
run: |
npm i
npm run build
- name: LIST ALL FILES
run: ls -R
2024-04-17 17:41:39 +00:00
- name: Install Linux dependencies
run: |
2024-04-17 19:27:55 +00:00
sudo apt install -y portaudio19-dev libhamlib-dev libhamlib-utils build-essential cmake python3-libhamlib2 patchelf desktop-file-utils
2024-04-17 17:41:39 +00:00
2024-03-11 09:42:24 +00:00
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build binaries
2024-04-18 09:04:25 +00:00
working-directory: freedata_server
2024-03-11 09:42:24 +00:00
run: |
python3 -m nuitka --remove-output --assume-yes-for-downloads --follow-imports --include-data-dir=lib=lib --include-data-files=lib/codec2/*=lib/codec2/ --include-data-files=config.ini.example=config.ini --standalone server.py --output-filename=freedata-server
- name: Prepare AppImage folder
run: |
mkdir -p $HOME/freedata-appimage
2024-04-17 18:22:19 +00:00
mkdir -p $HOME/freedata-appimage/gui
mkdir -p $HOME/freedata-appimage/server
2024-03-11 09:42:24 +00:00
- name: Copy GUI
run: |
2024-04-18 13:27:16 +00:00
cp -r freedata_gui/release/linux-unpacked/* $HOME/freedata-appimage/gui
2024-03-11 09:42:24 +00:00
- name: Copy server
run: |
2024-04-18 13:27:16 +00:00
cp -r freedata_server/server.dist/* $HOME/freedata-appimage/server
2024-03-11 09:42:24 +00:00
- name: Copy Icon
run: |
2024-04-18 13:27:16 +00:00
cp freedata_gui/build/icon.png $HOME/freedata-appimage/icon.png
2024-03-11 09:42:24 +00:00
- name: Create Desktop shortcut
run: |
2024-04-19 08:04:06 +00:00
echo "[Desktop Entry]" > $HOME/freedata-appimage/FreeDATA.desktop
echo "Type=Application" >> $HOME/freedata-appimage/FreeDATA.desktop
echo "Name=FreeDATA" >> $HOME/freedata-appimage/FreeDATA.desktop
echo "Icon=icon" >> $HOME/freedata-appimage/FreeDATA.desktop
echo "Exec=AppRun" >> $HOME/freedata-appimage/FreeDATA.desktop
echo "Categories=Utility" >> $HOME/freedata-appimage/FreeDATA.desktop
2024-03-11 09:42:24 +00:00
- name: Create AppImage build script
run: |
2024-03-11 19:13:17 +00:00
echo '#!/bin/bash
2024-03-11 09:42:24 +00:00
# Navigate to the AppDir root; this ensures relative paths work as expected
cd "$(dirname "$(readlink -f "${0}")")"
# check if config exists in ~/.config/FreeDATA/config.ini else create it
SERVER_CONFIG_FILE=~/.config/FreeDATA/config.ini
if test -f "$SERVER_CONFIG_FILE"; then
echo "$SERVER_CONFIG_FILE exists."
else
echo "$SERVER_CONFIG_FILE does not exist. Copying the default one"
mkdir ~/.config/FreeDATA
cp server.dist/config.ini $SERVER_CONFIG_FILE
fi
export FREEDATA_CONFIG=$SERVER_CONFIG_FILE
# Launch the main application executable from the linux-unpacked directory
./linux-unpacked/freedata
2024-04-17 18:44:25 +00:00
' > $HOME/freedata-appimage/AppRun
2024-03-11 19:13:17 +00:00
chmod +x $HOME/freedata-appimage/AppRun
2024-03-11 09:42:24 +00:00
- name: Download AppImage
run: |
wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
- name: Execute AppImage
run: |
2024-04-17 19:49:25 +00:00
./appimagetool-x86_64.AppImage $HOME/freedata-appimage/
2024-03-11 09:42:24 +00:00
- name: LIST ALL FILES
run: ls -R
2024-04-19 08:43:25 +00:00
2024-03-11 09:42:24 +00:00
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'FreeDATA-x86_64.AppImage'
2024-04-19 09:50:18 +00:00
path: FreeDATA-x86_64.AppImage
2024-03-11 09:42:24 +00:00
- name: Upload Installer to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
2024-04-19 09:50:18 +00:00
files: FreeDATA-x86_64.AppImage
2024-03-11 09:42:24 +00:00
tag_name: ${{ github.ref_name }}
name: 'FreeDATA-x86_64.AppImage'