#-------------------------------------------------------------------------------- # Workflow configuration #-------------------------------------------------------------------------------- name: Deploy on: push: # Run on push paths-ignore: # File patterns to ignore - '**.md' # Ignore changes to *.md files - '**.tar.gz' # Ignore database updates pull_request: # Run on pull-request paths-ignore: # File-patterns to ignore - '**.md' # Ignore changes to *.md files - '**.tar.gz' # Ignore database updates #-------------------------------------------------------------------------------- # Define application name & version #-------------------------------------------------------------------------------- env: VERSION: "2.1.0" QT_VERSION_LINUX: 6.7.1 QT_VERSION_MACOS: 6.7.1 QT_VERSION_WINDOWS: 6.7.1 EXECUTABLE: "Serial-Studio" APPLICATION: "Serial Studio" UNIXNAME: "serial-studio" QML_DIR: "../../app/qml" PUBLISHER: "Alex Spataru" QT_MODULES: qtserialport qtconnectivity qtpositioning qtlocation CORES: 16 #-------------------------------------------------------------------------------- # Workflow jobs (GNU/Linux, macOS & Windows) #-------------------------------------------------------------------------------- jobs: # # Linux build # build-linux: runs-on: ubuntu-20.04 name: '🐧 Ubuntu 20.04' steps: - name: '🧰 Checkout' uses: actions/checkout@v4 - name: '⚙️ Install Qt' uses: jurplel/install-qt-action@v3 with: version: ${{env.QT_VERSION_LINUX}} modules: ${{env.QT_MODULES}} cache: true install-deps: 'true' - name: '⚙️ Install dependencies' run: | sudo apt-get update sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libzstd-dev libxcb-image0-dev libxcb-util0-dev libxcb-cursor-dev libssl-dev libudev-dev libusb-1.0-0-dev libssl-dev - name: '⚙️ Install CMake' uses: lukka/get-cmake@latest with: useLocalCache: true - name: '🚧 Configure with CMake' run: | mkdir build cd build cmake ../ -DCMAKE_BUILD_TYPE=Release - name: '🚧 Build application' run: | cd build cmake --build . --config Release -j 10 - name: '⚙️ Install linuxdeploy' run: | cd "build/app" wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage chmod +x linuxdeploy-x86_64.AppImage chmod +x linuxdeploy-plugin-qt-x86_64.AppImage - name: '📦 Create AppImage' run: | cd "build/app" export QML_SOURCES_PATHS="${{env.QML_DIR}}" export QMAKE=/home/runner/work/${{env.EXECUTABLE}}/Qt/${{env.QT_VERSION_LINUX}}/gcc_64/bin/qmake export PATH=/home/runner/work/${{env.EXECUTABLE}}/Qt/${{env.QT_VERSION_LINUX}}/gcc_64/libexec:$PATH ./linuxdeploy-x86_64.AppImage --appdir AppDir -e ${{env.UNIXNAME}} -i ../../app/deploy/linux/${{env.UNIXNAME}}.png -d ../../app/deploy/linux/${{env.UNIXNAME}}.desktop --plugin qt --output appimage rm linuxdeploy-x86_64.AppImage rm linuxdeploy-plugin-qt-x86_64.AppImage mv *.AppImage ../../${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage - name: '📤 Upload artifact: AppImage' uses: actions/upload-artifact@v4 with: name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage path: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage # # macOS (arm64) build # build-mac: runs-on: macos-latest name: '🍎 macOS' steps: - name: '🧰 Checkout' uses: actions/checkout@v4 - name: '⚙️ Install Qt' uses: jurplel/install-qt-action@v3 with: version: ${{env.QT_VERSION_MACOS}} modules: ${{env.QT_MODULES}} arch: clang_64 cache: 'true' - name: '⚙️ Install CMake' uses: lukka/get-cmake@latest with: useLocalCache: true - name: '⚙️ Install Node' uses: actions/setup-node@v4 with: node-version: 20 - name: '🚧 Configure with CMake' run: | mkdir build cd build cmake ../ -DCMAKE_BUILD_TYPE=Release - name: '🚧 Build application' run: | cd build cmake --build . --config Release -j 10 - name: '📦 Package application' run: | cd build cpack --verbose - name: '🪪 Import Code Signing Certificate' uses: apple-actions/import-codesign-certs@v2 with: p12-file-base64: ${{secrets.CERTIFICATES_P12}} p12-password: ${{secrets.CERTIFICATES_P12_PASSWORD}} - name: '💿 Mount DMG and copy application' run: | VOLUME=$(yes | hdiutil attach ./build/*.dmg -nobrowse | grep "Volumes" | awk '{print $3}') cp -a "$VOLUME/${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app" hdiutil detach "$VOLUME" - name: '✍🏻 Sign Application' run: codesign --force --deep --options runtime --sign "${{secrets.DEVELOPER_ID}}" "${{env.APPLICATION}}.app" - name: '💽 Create nice DMG' run: | npm install --global create-dmg rm LICENSE.md create-dmg "${{env.APPLICATION}}.app" --dmg-title="${{env.APPLICATION}}" mv "${{env.APPLICATION}} ${{env.VERSION}}.dmg" "${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg" - name: '📋 Notarize' uses: alex-spataru/xcode-notarize@v2 with: product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg appstore-connect-username: ${{secrets.NOTARIZATION_USERNAME}} appstore-connect-teamid: ${{secrets.NOTARIZATION_TEAMID}} appstore-connect-password: ${{secrets.NOTARIZATION_PASSWORD}} - name: '📌 Staple' uses: BoundfoxStudios/action-xcode-staple@v1 with: product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg - name: '📤 Upload artifact: DMG' uses: actions/upload-artifact@v4 with: name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg # # Windows build # build-windows: runs-on: windows-latest name: '🧊 Windows' steps: - run: git config --global core.autocrlf input - name: '🧰 Checkout' uses: actions/checkout@v4 - name: '⚙️ Install Qt' uses: jurplel/install-qt-action@v3 with: version: ${{env.QT_VERSION_WINDOWS}} modules: ${{env.QT_MODULES}} cache: 'true' - name: '⚙️ Install CMake' uses: lukka/get-cmake@latest with: useLocalCache: true - name: '🚧 Configure with CMake' run: | mkdir build cd build cmake ../ -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_BUILD_TYPE=Release - name: '🚧 Build application' run: | cd build cmake --build . --config Release -j 10 - name: '📦 Package application' run: | cd build cpack --verbose mv *.exe ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe mv ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe ../ - name: '📤 Upload artifact: NSIS installer' uses: actions/upload-artifact@v4 with: name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe path: ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe # Upload continuous build upload: name: '🗂 Create release and upload artifacts' needs: - build-mac - build-windows - build-linux runs-on: ubuntu-latest steps: - name: '📥 Download artifacts' uses: actions/download-artifact@v4 - name: '🗂 Inspect directory after downloading artifacts' run: ls -alFR - name: '🚀 Create release and upload artifacts' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | sudo apt-get update sudo apt-get install libfuse2 wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage chmod +x pyuploadtool-x86_64.AppImage ./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage ./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg ./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe