Linux: add flatpak support #1262
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2004-2024 Robert Griebl | |
# SPDX-License-Identifier: GPL-3.0-only | |
name: CMake Build Matrix | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
BRICKSTORE_QT6_DEB_PACKAGES: >- | |
build-essential cmake ninja-build | |
libglvnd-dev libtbb-dev | |
qt6-tools-dev qt6-tools-dev-tools | |
qt6-l10n-tools qt6-documentation-tools | |
qt6-base-dev qt6-base-private-dev qt6-base-dev-tools | |
qt6-qpa-plugins | |
BRICKSTORE_GUI_QT6_DEB_PACKAGES: >- | |
libsecret-1-dev | |
qt6-declarative-dev qt6-declarative-private-dev | |
qt6-quick3d-dev qt6-quick3d-dev-tools libqt6shadertools6-dev | |
qt6-gtk-platformtheme libqt6svg6-dev qt6-multimedia-dev | |
qt6-image-formats-plugins | |
qml6-module-qt5compat-graphicaleffects qml6-module-qtmultimedia | |
qml6-module-qtqml-workerscript qml6-module-quick3d | |
BRICKSTORE_GUI_QT6_INSTALLER_MODULES: >- | |
qtquick3d qtshadertools qtquicktimeline qt5compat qtimageformats qtmultimedia | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- next | |
tags: | |
- v* | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.runs-on }} | |
outputs: | |
snap-file: ${{ steps.create-snap.outputs.snap || '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: "Windows Intel 64bit" | |
artifact: "Windows-x64" | |
runs-on: windows-2019 | |
os: windows | |
qt_host: 'windows' | |
qt_version: '6.6.3' | |
qt_arch: 'win64_msvc2019_64' | |
qt_dir: "msvc2019_64" | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
cmake_extra_config: '-DSENTRY=ON' | |
- name: "Windows ARM 64bit" | |
artifact: "Windows-ARM64" | |
runs-on: windows-2019 | |
os: windows | |
qt_host: 'windows' | |
qt_host_arch: 'win64_msvc2019_64' | |
qt_version: '6.6.3' | |
qt_arch: 'win64_msvc2019_arm64' | |
qt_dir: "msvc2019_arm64" | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvarsamd64_arm64.bat" | |
cmake_extra_config: '-DCMAKE_TOOLCHAIN_FILE=%Qt6_DIR%/lib/cmake/Qt6/qt.toolchain.cmake -DQT_HOST_PATH=%Qt6_DIR%/../msvc2019_64' | |
- name: "Ubuntu 22.04" | |
artifact: "Ubuntu-22.04" | |
runs-on: ubuntu-22.04 | |
os: linux | |
debian_container: "buildpack-deps:22.04" | |
- name: "Debian 12 Backend" | |
artifact: "Debian-12-Backend" | |
runs-on: ubuntu-22.04 | |
os: linux | |
debian_container: "buildpack-deps:bookworm" | |
cmake_extra_config: "-DBACKEND_ONLY=ON" | |
generate_docs: true | |
generate_docker: true | |
- name: "Linux AppImage" | |
artifact: "Linux-AppImage" | |
runs-on: ubuntu-20.04 | |
os: linux | |
appimage: true | |
qt_tools: tools_opensslv3_src | |
qt_host: 'linux' | |
qt_version: '6.6.3' | |
qt_arch: 'gcc_64' | |
- name: "Ubuntu Snap" | |
artifact: "Linux-Snap" | |
runs-on: ubuntu-22.04 | |
os: linux | |
snap: true | |
qt_tools: tools_opensslv3_src | |
qt_host: 'linux' | |
qt_version: '6.6.3' | |
qt_arch: 'gcc_64' | |
- name: "Linux Flatpak" | |
artifact: "Linux-Flatpak" | |
runs-on: ubuntu-22.04 | |
os: linux | |
flatpak: true | |
qt_tools: tools_opensslv3_src | |
qt_host: 'linux' | |
qt_version: '6.6.3' | |
qt_arch: 'gcc_64' | |
- name: "macOS Universal" | |
artifact: "macOS" | |
runs-on: macos-13 | |
os: macos | |
qt_host: 'mac' | |
qt_version: '6.6.3' | |
qt_arch: 'clang_64' | |
qt_dir: 'macos' | |
cmake_extra_config: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSENTRY=ON' | |
xcode: '15.1' # https://developer.apple.com/forums/thread/740889 | |
- name: "macOS 10 Legacy" | |
artifact: "macOS-10-Legacy" | |
runs-on: macos-12 | |
os: macos | |
qt_host: 'mac' | |
qt_version: '6.4.3' | |
qt_arch: 'clang_64' | |
qt_dir: 'macos' | |
cmake_extra_config: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DSENTRY=ON' | |
- name: "Android" | |
artifact: "Android" | |
runs-on: ubuntu-20.04 | |
os: android | |
android_abi: 'arm64-v8a' | |
android_ndk: '26.3.11579264' | |
qt_host: 'linux' | |
qt_host_arch: 'gcc_64' | |
qt_target: 'android' | |
qt_version: '6.6.3' | |
qt_arch: 'android_x86_64' | |
qt_extra_archs: 'android_arm64_v8a android_armv7 android_x86' | |
cmake_extra_config: '-DSENTRY=ON' | |
- name: "iOS" | |
artifact: "iOS" | |
runs-on: macos-13 | |
os: ios | |
qt_host: 'mac' | |
qt_host_arch: 'clang_64' | |
qt_target: 'ios' | |
qt_version: '6.6.3' | |
qt_arch: 'ios' | |
cmake_extra_config: '' | |
xcode: '15.2' | |
# BUILD | |
################################################# | |
steps: | |
# Checkout | |
################################################# | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Get Qt | |
################################################# | |
- name: Cache Qt from aqtinstall | |
id: cache-qt | |
if: (matrix.config.os != 'linux') || matrix.config.appimage || matrix.config.snap || matrix.config.flatpak | |
uses: actions/cache@v4 | |
with: | |
path: "${{ runner.workspace }}/Qt/" | |
key: "Qt-${{ matrix.config.qt_version }}-${{ matrix.config.qt_host }}-${{ matrix.config.qt_arch }}" | |
- name: Install Qt via aqtinstall | |
if: | | |
((matrix.config.os != 'linux') || matrix.config.appimage || matrix.config.snap || matrix.config.flatpak) | |
&& (steps.cache-qt.outputs.cache-hit != 'true') | |
shell: sh | |
run: | | |
python3 -m pip install aqtinstall | |
if [ "${{ matrix.config.qt_host_arch }}" != "" ]; then | |
python3 -m aqt -c .github/aqt-settings.ini install-qt -O "${{ runner.workspace }}/Qt/" \ | |
${{ matrix.config.qt_host }} desktop \ | |
${{ matrix.config.qt_version }} ${{ matrix.config.qt_host_arch }} \ | |
-m $BRICKSTORE_GUI_QT6_INSTALLER_MODULES | |
fi | |
for arch in ${{ matrix.config.qt_arch }} ${{ matrix.config.qt_extra_archs }}; do | |
python3 -m aqt -c .github/aqt-settings.ini install-qt -O "${{ runner.workspace }}/Qt/" \ | |
${{ matrix.config.qt_host }} ${{ matrix.config.qt_target || 'desktop' }} \ | |
${{ matrix.config.qt_version }} $arch \ | |
-m $BRICKSTORE_GUI_QT6_INSTALLER_MODULES | |
if [ "${{ matrix.config.qt_tools }}" != "" ]; then | |
python3 -m aqt -c .github/aqt-settings.ini install-tool -O "${{ runner.workspace }}/Qt/" \ | |
${{ matrix.config.qt_host }} ${{ matrix.config.qt_target || 'desktop' }} \ | |
${{ matrix.config.qt_tools }} | |
fi | |
done | |
- name: Install Qt via aqtinstall (finalize) | |
if: | | |
((matrix.config.os != 'linux') || matrix.config.appimage || matrix.config.snap || matrix.config.flatpak) | |
shell: sh | |
run: | | |
# Set and export Qt6_DIR | |
if [ "${{ matrix.config.os }}" = "windows" ]; then | |
export Qt6_DIR="${{ runner.workspace }}\\Qt\\${{ matrix.config.qt_version }}\\${{ matrix.config.qt_dir || matrix.config.qt_arch }}" | |
else | |
export Qt6_DIR="${{ runner.workspace }}/Qt/${{ matrix.config.qt_version }}/${{ matrix.config.qt_dir || matrix.config.qt_arch }}" | |
fi | |
echo "Qt6_DIR=$Qt6_DIR" >> $GITHUB_ENV | |
# Fix broken Windows / ARM64 setup | |
if [ "${{ matrix.config.qt_arch }}" = "win64_msvc2019_arm64" ]; then | |
# Qt < 6.5.0 | |
sed -i "s,/Users/qt/work/install/,`echo -E ${Qt6_DIR} | tr '\\' '/'`/../msvc2019_64/," "${Qt6_DIR}/bin/qtpaths.bat" | |
sed -i "s,/Users/qt/work/install/,`echo -E ${Qt6_DIR} | tr '\\' '/'`/../msvc2019_64/," "${Qt6_DIR}/bin/qmake.bat" | |
# Qt >= 6.5.0 | |
sed -i "s,\\\Users\\\qt\\\work\\\install\\\,`echo -E ${Qt6_DIR} | sed -e 's,\\\,\\\\\\\,g'`\\\..\\\msvc2019_64\\\," "${Qt6_DIR}/bin/qtpaths.bat" | |
sed -i "s,\\\Users\\\qt\\\work\\\install\\\,`echo -E ${Qt6_DIR} | sed -e 's,\\\,\\\\\\\,g'`\\\..\\\msvc2019_64\\\," "${Qt6_DIR}/bin/qmake.bat" | |
${Qt6_DIR}/bin/qmake.bat -query | |
fi | |
# remove all sqldrivers, except sqlite to avoid missing dependencies when packaging | |
find "$Qt6_DIR/plugins/sqldrivers" -type f -not -ipath "*qsqlite*" -delete | |
find "$Qt6_DIR/lib/cmake/Qt6Sql" -name "*DriverPlugin*" -not -name "*QSQLite*" -delete | |
# macOS/Windows: remove the openssl TLS plugin, as this can cause problems | |
case "${{ matrix.config.os }}" in | |
macos|windows) | |
find "$Qt6_DIR/plugins/tls" -type f -ipath "*qopensslbackend*" -delete | |
find "$Qt6_DIR/lib/cmake/Qt6Network" -name "*QTlsBackendOpenSSL*" -delete | |
;; | |
esac | |
- name: Install Qt from Linux Distro (container) | |
if: (matrix.config.os == 'linux') && matrix.config.debian_container | |
run: | | |
sudo -E docker run -v `pwd`:/brickstore -e BUILD_NUMBER --rm --name "debian-build" -d "${{ matrix.config.debian_container }}" sleep 1d | |
sudo docker exec -e DEBIAN_FRONTEND=noninteractive "debian-build" apt -y update | |
sudo docker exec -e DEBIAN_FRONTEND=noninteractive "debian-build" apt -y install \ | |
$BRICKSTORE_QT6_DEB_PACKAGES \ | |
$BRICKSTORE_GUI_QT6_DEB_PACKAGES \ | |
debhelper lsb-release fakeroot build-essential | |
shell: bash | |
# Build for Windows | |
################################################# | |
- name: Build for Windows | |
if: (matrix.config.os == 'windows') | |
run: | | |
call "${{ matrix.config.environment_script }}" | |
call %Qt6_DIR%\bin\qt-cmake.bat -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ matrix.config.cmake_extra_config }} -B build -S . | |
cmake --build build --config RelWithDebInfo --parallel --target installer --verbose | |
shell: cmd | |
- name: Upload Windows Installer | |
if: (matrix.config.os == 'windows') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: "build/*.exe" | |
- name: Upload Windows debug info to sentry.io | |
if: (matrix.config.os == 'windows') | |
run: | | |
curl.exe -L --output ..\\sentry-cli.exe "https://github.com/getsentry/sentry-cli/releases/latest/download/sentry-cli-Windows-i686.exe" | |
..\\sentry-cli.exe --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} upload-dif --org brickstore --project brickstore build/bin ${Qt6_DIR}/bin | |
shell: cmd | |
# Build for Linux | |
################################################# | |
- name: Build for Linux (Debian package) | |
if: (matrix.config.os == 'linux') && matrix.config.debian_container | |
run: | | |
sudo docker exec -w /brickstore "debian-build" /usr/lib/qt6/bin/qt-cmake -G Ninja \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
sudo docker exec -w /brickstore "debian-build" cmake --build build --config RelWithDebInfo \ | |
--parallel --target deb-package --verbose | |
shell: bash | |
- name: Upload Linux DEB | |
if: (matrix.config.os == 'linux') && matrix.config.debian_container | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: "build/*.deb" | |
# Build for Linux (AppImage / Snap / Flatpak) | |
################################################# | |
- name: Build for Linux (AppImage) | |
if: matrix.config.appimage | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt -y update | |
sudo DEBIAN_FRONTEND=noninteractive apt -y install \ | |
g++-10 cmake ninja-build libglvnd-dev libtbb-dev libxkbcommon-dev libxkbcommon-x11-0 \ | |
libxcb-\* libpulse-dev libgstreamer\*1.0-dev libsecret-1-dev libva-dev | |
${Qt6_DIR}/bin/qt-cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
cmake --build build --config RelWithDebInfo --parallel --verbose | |
env DESTDIR=build/BrickStore-Install cmake --install build --config RelWithDebInfo --prefix /usr | |
shell: bash | |
- name: Build for Linux (Snap / Flatpak) | |
if: matrix.config.snap || matrix.config.flatpak | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt -y update | |
sudo DEBIAN_FRONTEND=noninteractive apt -y install \ | |
g++ cmake ninja-build libglvnd-dev libtbb-dev libxkbcommon-dev libxkbcommon-x11-0 \ | |
libxcb-\* libpulse-dev libgstreamer\*1.0-dev libsecret-1-dev libva-dev | |
${Qt6_DIR}/bin/qt-cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
cmake --build build --config RelWithDebInfo --parallel --verbose | |
env DESTDIR=build/BrickStore-Install cmake --install build --config RelWithDebInfo --prefix /usr | |
shell: bash | |
- name: OpenSSLv3 for Linux (AppImage / Snap / Flatpak) | |
if: matrix.config.appimage || matrix.config.snap || matrix.config.flatpak | |
run: | | |
cd ${Qt6_DIR}/../../Tools/OpenSSLv3/src | |
./Configure --prefix=/usr --libdir=lib --openssldir=/etc/ssl '-Wl,-rpath,\$$ORIGIN,--enable-new-dtags' | |
make -j4 build_libs | |
make DESTDIR=${GITHUB_WORKSPACE}/build/BrickStore-Install install_runtime_libs | |
# Qt opens the unversioned libs first, so we need to prevent those from being | |
# loaded from the host system. | |
cd ${GITHUB_WORKSPACE}/build/BrickStore-Install/usr/lib/ | |
for i in crypto ssl; do | |
rm -f lib${i}.so.1* | |
ln -sr lib${i}.so.3 lib${i}.so | |
done | |
shell: bash | |
- name: Create Linux AppImage | |
if: matrix.config.appimage | |
run: | | |
mkdir -p .linuxdeploy | |
wget -P .linuxdeploy -N "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" | |
chmod +x .linuxdeploy/linuxdeploy-x86_64.AppImage | |
wget -P .linuxdeploy -N "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" | |
chmod +x .linuxdeploy/linuxdeploy-plugin-qt-x86_64.AppImage | |
env VERSION=`cat VERSION_NUMBER` QML_SOURCES_PATHS=src EXTRA_QT_PLUGINS=svg \ | |
"QMAKE=${Qt6_DIR}/bin/qmake" "LD_LIBRARY_PATH=${Qt6_DIR}/lib" \ | |
.linuxdeploy/linuxdeploy-x86_64.AppImage \ | |
--appdir=build/BrickStore-Install \ | |
-e build/bin/brickstore \ | |
-i assets/generated-app-icons/brickstore.png \ | |
-d unix/brickstore.desktop \ | |
-l /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libva.so \ | |
-l /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libva-drm.so \ | |
-l /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libva-x11.so \ | |
--plugin qt \ | |
--output appimage | |
shell: bash | |
- name: Upload Linux AppImage | |
if: matrix.config.appimage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: "*.AppImage" | |
- name: Create Linux Snap / Flatpak 1 | |
if: matrix.config.snap || matrix.config.flatpak | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt -y install libfuse2 | |
wget -P .cqtdeployer -N "https://github.com/QuasarApp/CQtDeployer/releases/download/v1.6.2351/CQtDeployer_1.6.2351.ec4840f_Linux_x86_64.zip" | |
unzip -u .cqtdeployer/CQtDeployer_1.6.2351.ec4840f_Linux_x86_64.zip -d .cqtdeployer | |
chmod +x .cqtdeployer/bin/CQtDeployer | |
chmod +x .cqtdeployer/CQtDeployer.sh | |
cd build | |
../.cqtdeployer/CQtDeployer.sh force-clear \ | |
-bin bin/brickstore -qmlDir ../src \ | |
-qmake "${Qt6_DIR}/bin/qmake" \ | |
-targetDir BrickStore-Install/usr -libOut lib -binOut bin \ | |
-disableRunScript brickstore -disableShortCut brickstore \ | |
-enablePlugins multimedia | |
- name: Create Linux Flatpak 2 | |
if: matrix.config.flatpak | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt -y flatpak flatpak-builder | |
cd build | |
flatpak-builder --verbose --install-deps-from flathub --force-clean --repo fp-repo \ | |
fp-build ./flatpak.yaml | |
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo fp-repo \ | |
BrickStore-`cat VERSION_NUMBER`-`flatpak --default-arch`.flatpak \ | |
dev.brickstore.BrickStore | |
- name: Upload Linux Flatpak | |
if: matrix.config.flatpak | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: "build/*.flatpak" | |
- name: Create Linux Snap 2 | |
if: matrix.config.snap | |
id: create-snap | |
uses: snapcore/action-build@v1 | |
with: | |
path: build | |
- name: Upload Linux Snap | |
if: matrix.config.snap | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: ${{ steps.create-snap.outputs.snap }} | |
- name: Publish to Snapcraft (edge channel) | |
if: matrix.config.snap | |
uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.UBUNTU_SNAP_LOGIN }} | |
with: | |
snap: ${{ steps.create-snap.outputs.snap }} | |
release: edge | |
# Build for Android | |
################################################# | |
- name: Build for Android | |
if: (matrix.config.os == 'android') | |
run: | | |
echo "Using NDK: $ANDROID_SDK_ROOT/ndk/${{ matrix.config.android_ndk }}" | |
echo "QT_HOST_PATH: $(readlink -f $Qt6_DIR/../gcc_64)" | |
# fix build-tools 33 (dx missing) | |
for dir in `find $ANDROID_SDK_ROOT/build-tools/ -type d -mindepth 1`; do | |
if [ -e $dir/d8 ] && [ ! -e $dir/dx ]; then | |
sudo cp -a $dir/lib/d8.jar $dir/lib/dx.jar | |
sudo cp -a $dir/d8 $dir/dx | |
fi | |
done | |
sudo DEBIAN_FRONTEND=noninteractive apt -y update | |
sudo DEBIAN_FRONTEND=noninteractive apt -y install cmake ninja-build | |
echo "${{ secrets.ANDROID_KEYSTORE_STORE_DATA }}" | base64 --decode >android_release.keystore | |
export QT_ANDROID_KEYSTORE_PATH="`pwd`/android_release.keystore" | |
export QT_ANDROID_KEYSTORE_ALIAS="${{ secrets.ANDROID_KEYSTORE_ALIAS }}" | |
export QT_ANDROID_KEYSTORE_STORE_PASS="${{ secrets.ANDROID_KEYSTORE_STORE_PASS }}" | |
export QT_ANDROID_KEYSTORE_KEY_PASS="${{ secrets.ANDROID_KEYSTORE_KEY_PASS }}" | |
${Qt6_DIR}/bin/qt-cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \ | |
-D "QT_HOST_PATH=$(readlink -f $Qt6_DIR/../gcc_64)" \ | |
-D "QT_ANDROID_SDK_BUILD_TOOLS_REVISION=30.0.3" \ | |
-D "QT_ANDROID_TARGET_SDK_VERSION=33" \ | |
-D "ANDROID_NATIVE_API_LEVEL=23" \ | |
-D "QT_ANDROID_BUILD_ALL_ABIS=TRUE" \ | |
-D "ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${{ matrix.config.android_ndk }}" \ | |
-D "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" \ | |
-D "QT_ANDROID_SIGN_AAB=TRUE" \ | |
-D "QT_ANDROID_MULTI_ABI_FORWARD_VARS=SENTRY" \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
echo "Creating AAB" | |
cmake --build build --config Release --parallel --target final-aab --verbose | |
echo "Creating ARM64 APK" | |
cmake --build build/android_abi_builds/arm64-v8a --config Release --parallel --target final-apk --verbose | |
echo "Creating ARM APK" | |
cmake --build build/android_abi_builds/armeabi-v7a --config Release --parallel --target final-apk --verbose | |
echo VERSION_NUMBER="`cat VERSION_NUMBER`" >> $GITHUB_ENV | |
shell: bash | |
- name: Upload Android AAB | |
if: (matrix.config.os == 'android') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }}-PlayStore | |
path: "build/*.aab" | |
- name: Upload Android ARM64 APK | |
if: (matrix.config.os == 'android') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }}-ARM64 | |
path: "build/android_abi_builds/arm64-v8a/*.apk" | |
- name: Upload Android ARM APK | |
if: (matrix.config.os == 'android') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }}-ARM | |
path: "build/android_abi_builds/armeabi-v7a/*.apk" | |
- name: Upload Android AAB to the PlayStore | |
if: (matrix.config.os == 'android') | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }} | |
packageName: de.brickforge.brickstore | |
releaseFiles: build/*.aab | |
status: completed | |
track: beta | |
releaseName: "${{ env.VERSION_NUMBER }} (build: ${{ env.BUILD_NUMBER }})" | |
# Build for macOS | |
################################################# | |
- name: Import signing certificate | |
if: (matrix.config.os == 'macos') | |
env: | |
SIGNING_CERTIFICATE_P12_DATA: ${{ secrets.MACOS_SIGNING_CERTIFICATE_P12_DATA }} | |
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_SIGNING_CERTIFICATE_PASSWORD }} | |
run: | | |
exec .github/scripts/apple-import-certificate.sh | |
- name: Import AppStore API key | |
if: (matrix.config.os == 'macos') | |
env: | |
API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }} | |
API_KEY_P8_DATA: ${{ secrets.APPSTORE_API_KEY_P8_DATA }} | |
run: | | |
exec .github/scripts/apple-import-apikey.sh | |
- name: Set XCode version for macOS | |
if: (matrix.config.os == 'macos' && matrix.config.xcode) | |
run: | | |
sudo xcode-select -s /Applications/Xcode_${{ matrix.config.xcode }}.app | |
shell: bash | |
- name: Build for macOS | |
if: (matrix.config.os == 'macos') | |
run: | | |
${Qt6_DIR}/bin/qt-cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-D "MACOS_SIGNING_IDENTITY=${{ secrets.MACOS_SIGNING_IDENTITY }}" \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
cmake --build build --config RelWithDebInfo --parallel --target dmg --verbose | |
shell: bash | |
- name: Notarize and staple macOS DMG | |
if: (matrix.config.os == 'macos') | |
run: | | |
xcrun notarytool submit --wait build/BrickStore-*.dmg \ | |
--issuer "${{ secrets.APPSTORE_API_KEY_ISSUER }}" \ | |
--key-id "${{ secrets.APPSTORE_API_KEY_ID }}" \ | |
--key "~/.appstoreconnect/private_keys/AuthKey_${{ secrets.APPSTORE_API_KEY_ID }}.p8" | |
xcrun stapler staple -v build/BrickStore-*.dmg | |
shell: bash | |
- name: Upload macOS DMG | |
if: (matrix.config.os == 'macos') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: "build/*.dmg" | |
- name: Upload macOS debug info to sentry.io | |
if: (matrix.config.os == 'macos') | |
run: | | |
brew install getsentry/tools/sentry-cli | |
brew link getsentry/tools/sentry-cli | |
/usr/local/bin/sentry-cli --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} upload-dif \ | |
--org brickstore --project brickstore build/BrickStore.app.dSYM ${Qt6_DIR}/lib/ | |
# Build for iOS | |
################################################# | |
# see here for a description of this setup | |
# https://betterprogramming.pub/deploy-an-ios-app-to-testflight-or-the-app-store-using-github-actions-c4d7082b1430 | |
- name: Import signing certificate | |
if: (matrix.config.os == 'ios') | |
env: | |
SIGNING_CERTIFICATE_P12_DATA: ${{ secrets.IOS_SIGNING_CERTIFICATE_P12_DATA }} | |
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.IOS_SIGNING_CERTIFICATE_PASSWORD }} | |
run: | | |
exec .github/scripts/apple-import-certificate.sh | |
- name: Import provisioning profile | |
if: (matrix.config.os == 'ios') | |
env: | |
PROVISIONING_PROFILE_DATA: ${{ secrets.IOS_PROVISIONING_PROFILE_DATA }} | |
PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.IOS_PROV_PROFILE }} | |
run: | | |
exec .github/scripts/apple-import-profile.sh | |
- name: Import AppStore API key | |
if: (matrix.config.os == 'ios') | |
env: | |
API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }} | |
API_KEY_P8_DATA: ${{ secrets.APPSTORE_API_KEY_P8_DATA }} | |
run: | | |
exec .github/scripts/apple-import-apikey.sh | |
- name: Set XCode version for iOS | |
if: (matrix.config.os == 'ios' && matrix.config.xcode) | |
run: | | |
sudo xcode-select -s /Applications/Xcode_${{ matrix.config.xcode }}.app | |
shell: bash | |
- name: Build for iOS | |
if: (matrix.config.os == 'ios') | |
run: | | |
${Qt6_DIR}/bin/qt-cmake -G Xcode -DCMAKE_BUILD_TYPE=Release \ | |
-D "QT_HOST_PATH=$(readlink -f $Qt6_DIR/../macos)" \ | |
-D "CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=${{ secrets.IOS_DEV_TEAM }}" \ | |
-D "CMAKE_XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER=${{ secrets.IOS_PROV_PROFILE }}" \ | |
-D "CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY=${{ secrets.IOS_CODE_SIGN_IDENTITY }}" \ | |
-D "CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE=Manual" \ | |
${{ matrix.config.cmake_extra_config }} -B build -S . | |
cmake --build build --config Release --parallel --target ipa --verbose | |
shell: bash | |
- name: Upload iOS IPA | |
if: (matrix.config.os == 'ios') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }}-AppStore | |
path: "build/*.ipa" | |
- name: Upload iOS IPA to the AppStore | |
if: (matrix.config.os == 'ios') | |
run: | | |
xcrun altool --upload-app -f build/BrickStore-*.ipa -t ios \ | |
--apiIssuer "${{ secrets.APPSTORE_API_KEY_ISSUER }}" \ | |
--apiKey "${{ secrets.APPSTORE_API_KEY_ID }}" | |
shell: bash | |
# Generate documentation | |
################################################# | |
- name: Generate Documentation | |
if: (matrix.config.os == 'linux') && matrix.config.debian_container && matrix.config.generate_docs && (github.ref == 'refs/heads/main') | |
run: | | |
sudo docker exec -w /brickstore "debian-build" cmake --build build --target extensions-doc --verbose | |
- name: Publish Documentation | |
if: matrix.config.generate_docs && (github.ref == 'refs/heads/main') | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build/doc/html/extensions | |
destination_dir: extensions | |
enable_jekyll: true | |
# Generate the Backend Docker image | |
################################################# | |
- name: Create and push Docker image | |
if: (matrix.config.os == 'linux') && matrix.config.generate_docker | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
cp build/*.deb docker/brickstore-backend.deb | |
cd docker | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin | |
docker build . --tag "rgriebl/brickstore-backend:$BUILD_NUMBER" | |
docker push "$DOCKER_USER/brickstore-backend:$BUILD_NUMBER" | |
# RELEASE | |
################################################# | |
release: | |
needs: [ build ] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts to Release | |
uses: actions/download-artifact@v4 | |
with: | |
path: 'artifacts' | |
- name: Rename Artifacts | |
run: | | |
find artifacts -mindepth 2 -type f -print0 | while read -d $'\0' a; do | |
d="$(dirname $a)" | |
mv "$a" "${d}-$(basename $a)" | |
rmdir "$d" || true | |
done | |
echo "Artifacts after flattening:" | |
find artifacts | |
echo VERSION_NUMBER="`cat VERSION_NUMBER`" >> $GITHUB_ENV | |
shell: bash | |
- name: Release | |
uses: docker://antonyurchenko/git-release:latest | |
# uses: rgriebl/git-release@testing | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: artifacts/* | |
- name: Create release on sentry.io | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: brickstore | |
SENTRY_PROJECT: brickstore | |
with: | |
version: "brickstore@${{ env.BUILD_NUMBER }}" | |
- name: Promote Snapcraft build to stable | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.UBUNTU_SNAP_LOGIN }} | |
SNAPCRAFT_HAS_TTY: "true" | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt -y install lxd snapcraft | |
(yes || true) | snapcraft promote --from-channel edge --to-channel stable brickstore | |
shell: bash |