From b248d30366f9bf448dbd803a015a55ff28238b04 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Wed, 19 Nov 2025 20:31:32 -0800 Subject: [PATCH] add version input to build workflows and update deployment scripts --- .github/workflows/build-linux.yml | 16 +++- .github/workflows/build-macos.yml | 18 ++++- .github/workflows/build-windows.yml | 12 +++ .github/workflows/build.yml | 36 +++++++-- scripts/deploy-dmg.sh | 121 +++++++++------------------- src/main.cpp | 6 +- 6 files changed, 114 insertions(+), 95 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 254aa84..fffee05 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -2,6 +2,18 @@ name: Build Linux on: workflow_dispatch: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + default: "dev" + workflow_call: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + type: string + default: "dev" env: QT_VERSION: "6.7.2" GO_VERSION: "1.23.0" @@ -150,10 +162,10 @@ jobs: - name: Build AppImage run: | - export VERSION=1.0.0 + export VERSION=${{ inputs.version }} # linuxdeployqt tries to bundle SQL drivers which we don't need rm -rf ${{ github.workspace }}/Qt/{${{ env.QT_VERSION }}/gcc_64/plugins/sqldrivers/** - ./scripts/deploy-appimage.sh $VERSION + ./scripts/deploy-appimage.sh ${{ inputs.version }} - name: Upload Artifact (Linux) if: runner.os == 'Linux' diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2217f92..aca01b5 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -2,6 +2,18 @@ name: Build macOS on: workflow_dispatch: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + default: "dev" + workflow_call: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + type: string + default: "dev" env: QT_VERSION: "6.7.2" GO_VERSION: "1.23.0" @@ -19,8 +31,8 @@ jobs: include: - runner: macos-15-intel arch: x86_64 - # - runner: macos-14 - # arch: arm64 + - runner: macos-14 + arch: arm64 runs-on: ${{ matrix.runner }} steps: @@ -140,7 +152,7 @@ jobs: run: cmake --build build --config Release - name: Deploy and create DMG - run: ./deploy-dmg.sh ${{ matrix.arch }} + run: ./scripts/deploy-dmg.sh ${{ matrix.arch }} ${{ inputs.version }} - name: Upload Artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 8295de1..d0a0897 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -2,6 +2,18 @@ name: Build Windows on: workflow_dispatch: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + default: "dev" + workflow_call: + inputs: + version: + description: "Build version (e.g., v1.2.3)" + required: true + type: string + default: "dev" env: QT_VERSION: "6.8.0" GO_VERSION: "1.23.0" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e55c10..3bdc1a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,21 +1,47 @@ -name: Build iDescriptor +name: Build & Release iDescriptor on: - # push: - # branches: ["main"] - # pull_request: - # branches: ["main"] + push: + tags: + - "v*" workflow_dispatch: jobs: build-linux: uses: ./.github/workflows/build-linux.yml + with: + version: ${{ github.ref_name }} secrets: inherit build-windows: uses: ./.github/workflows/build-windows.yml + with: + version: ${{ github.ref_name }} secrets: inherit build-macos: uses: ./.github/workflows/build-macos.yml + with: + version: ${{ github.ref_name }} secrets: inherit + + release: + needs: [build-linux, build-windows, build-macos] + runs-on: ubuntu-latest + + steps: + - name: Prepare output folder + run: mkdir target + + - name: Download all artifacts + uses: actions/download-artifact@v6 + with: + path: target + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: target/* + tag: ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/deploy-dmg.sh b/scripts/deploy-dmg.sh index 2276dd3..7d75bd0 100755 --- a/scripts/deploy-dmg.sh +++ b/scripts/deploy-dmg.sh @@ -3,17 +3,31 @@ set -euo pipefail ARCH="${1:-x86_64}" +VERSION="${2:-dev}" BUILD_DIR="build" APP_PATH="${BUILD_DIR}/iDescriptor.app" -echo "Starting deployment for architecture: ${ARCH}" -# Deploy Qt dependencies -echo "Deploying Qt dependencies..." -macdeployqt "${APP_PATH}" -qmldir=qml -verbose=2 +echo "Deploying iDescriptor DMG for ${ARCH} architecture (version: ${VERSION})" + +# Determine the platform-specific suffix for the DMG name based on architecture +PLATFORM_SUFFIX="" +if [ "${ARCH}" == "x86_64" ]; then + PLATFORM_SUFFIX="Apple_Intel" +elif [ "${ARCH}" == "arm64" ]; then + PLATFORM_SUFFIX="Apple_Silicon" +else + echo "Error: Unsupported architecture '${ARCH}'." + exit 1 +fi + +# Ensure the app exists +if [ ! -d "${APP_PATH}" ]; then + echo "Error: ${APP_PATH} not found." + exit 1 +fi + -# Bundle GStreamer -echo "Bundling GStreamer..." GST_PLUGIN_DIR="${APP_PATH}/Contents/Frameworks/gstreamer" mkdir -p "${GST_PLUGIN_DIR}" @@ -30,28 +44,26 @@ PLUGINS=( "libgstvolume" ) +BREW_PREFIX="$(brew --prefix)" + +# Copy GStreamer plugins for plugin in "${PLUGINS[@]}"; do - cp "$(brew --prefix gstreamer)/lib/gstreamer-1.0/${plugin}.dylib" "${GST_PLUGIN_DIR}/" + cp "${BREW_PREFIX}/lib/gstreamer-1.0/${plugin}.dylib" "${GST_PLUGIN_DIR}/" done +# Copy gst-plugin-scanner cp "$(brew --prefix gstreamer)/libexec/gstreamer-1.0/gst-plugin-scanner" "${APP_PATH}/Contents/Frameworks/" # Bundle libjxl_cms -echo "Bundling libjxl_cms..." -cp "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" "${APP_PATH}/Contents/Frameworks/" +# For some reason libjxl_cms is not bundled by macdeployqt, so we do it manually +cp "${BREW_PREFIX}/lib/libjxl_cms.0.11.dylib" "${APP_PATH}/Contents/Frameworks/" install_name_tool -id "@rpath/libjxl_cms.0.11.dylib" "${APP_PATH}/Contents/Frameworks/libjxl_cms.0.11.dylib" -install_name_tool -change "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" "@rpath/libjxl_cms.0.11.dylib" "${APP_PATH}/Contents/Frameworks/libjxl.0.11.dylib" -# Add rpath to main executable -echo "Adding rpath to main executable..." +# Add RPATH to main executable install_name_tool -add_rpath "@executable_path/../Frameworks" "${APP_PATH}/Contents/MacOS/iDescriptor" -# Fix GStreamer library paths -echo "Fixing GStreamer library paths..." -FRAMEWORKS_DIR="${APP_PATH}/Contents/Frameworks" -BREW_PREFIX="$(brew --prefix)" -# Copy GStreamer core libraries +# Copy GStreamer + GLib core libraries GST_LIBS=( "libgstreamer-1.0.0.dylib" "libgstbase-1.0.0.dylib" @@ -62,6 +74,8 @@ GST_LIBS=( "libgsttag-1.0.0.dylib" "libgstriff-1.0.0.dylib" "libgstcodecparsers-1.0.0.dylib" + "libgstrtp-1.0.0.dylib" + "libgstsdp-1.0.0.dylib" "libglib-2.0.0.dylib" "libgobject-2.0.0.dylib" "libgmodule-2.0.0.dylib" @@ -69,79 +83,24 @@ GST_LIBS=( "libgthread-2.0.0.dylib" ) +FRAMEWORKS_DIR="${APP_PATH}/Contents/Frameworks" + for lib in "${GST_LIBS[@]}"; do if [ -f "${BREW_PREFIX}/lib/${lib}" ]; then cp "${BREW_PREFIX}/lib/${lib}" "${FRAMEWORKS_DIR}/" install_name_tool -id "@rpath/${lib}" "${FRAMEWORKS_DIR}/${lib}" - echo "Copied and fixed ID for ${lib}" + echo "✓ Copied and fixed ID for ${lib}" fi done -# For some reason libavfilter sometimes doesnt get copied by macdeployqt +# Copy FFmpeg libavfilter FFMPEG_LIB_DIR="$(brew --prefix ffmpeg)/lib" cp "${FFMPEG_LIB_DIR}"/libavfilter.*.dylib "${FRAMEWORKS_DIR}/" -# Copy additional audio-related libraries that are missing -echo "Bundling additional audio libraries..." -ADDITIONAL_LIBS=( - "libarchive.13.dylib" - "libass.9.dylib" - "libb2.1.dylib" - "libfribidi.0.dylib" - "libgif.dylib" - "libgraphite2.3.dylib" - "libharfbuzz.0.dylib" - "libjpeg.8.dylib" - "liblcms2.2.dylib" - "libleptonica.6.dylib" - "liblz4.1.dylib" - "librubberband.3.dylib" - "libsamplerate.0.dylib" - "libtesseract.5.dylib" - "libtiff.6.dylib" - "libunibreak.6.dylib" - "libvidstab.1.2.dylib" - "libzimg.2.dylib" -) +macdeployqt "${APP_PATH}" -qmldir=qml -verbose=2 -for lib in "${ADDITIONAL_LIBS[@]}"; do - if [ -f "${BREW_PREFIX}/lib/${lib}" ]; then - cp "${BREW_PREFIX}/lib/${lib}" "${FRAMEWORKS_DIR}/" - install_name_tool -id "@rpath/${lib}" "${FRAMEWORKS_DIR}/${lib}" - else - echo "Warning: ${lib} not found, skipping..." - fi -done +DMG_NAME="iDescriptor-${VERSION}-${PLATFORM_SUFFIX}.dmg" -# Fix dependencies in all GStreamer plugins -echo "Fixing GStreamer plugin dependencies..." -for plugin in "${GST_PLUGIN_DIR}"/*.dylib; do - echo "Fixing plugin: $(basename "${plugin}")" - - # Get all dependencies and fix them - otool -L "${plugin}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do - depname=$(basename "${dep}") - echo " Changing ${depname}" - install_name_tool -change "${dep}" "@rpath/${depname}" "${plugin}" 2>/dev/null || true - done -done - -# Fix dependencies in GStreamer core libraries themselves -echo "Fixing GStreamer core library dependencies..." -for lib in "${FRAMEWORKS_DIR}"/libgst*.dylib "${FRAMEWORKS_DIR}"/libglib*.dylib "${FRAMEWORKS_DIR}"/libgobject*.dylib "${FRAMEWORKS_DIR}"/libgmodule*.dylib "${FRAMEWORKS_DIR}"/libgio*.dylib "${FRAMEWORKS_DIR}"/libgthread*.dylib; do - if [ -f "${lib}" ]; then - echo "Fixing library: $(basename "${lib}")" - - otool -L "${lib}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do - depname=$(basename "${dep}") - echo " Changing ${depname}" - install_name_tool -change "${dep}" "@rpath/${depname}" "${lib}" 2>/dev/null || true - done - fi -done - -# Create DMG -echo "Creating DMG..." create-dmg \ --volname "iDescriptor" \ --volicon "resources/icons/app-icon/icon.icns" \ @@ -151,7 +110,5 @@ create-dmg \ --icon "iDescriptor.app" 175 190 \ --hide-extension "iDescriptor.app" \ --app-drop-link 425 190 \ - "${BUILD_DIR}/iDescriptor-macOS-${ARCH}.dmg" \ - "${APP_PATH}" - -echo "Deployment complete for architecture: ${ARCH}" + "${BUILD_DIR}/${DMG_NAME}" \ + "${APP_PATH}" \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 48504a8..f6437b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,9 +62,9 @@ int main(int argc, char *argv[]) QString gstPluginScannerPath = QDir::toNativeSeparators(frameworksPath + "/gst-plugin-scanner"); - qputenv("GST_PLUGIN_PATH", gstPluginPath.toUtf8()); - qputenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8()); - qputenv("GST_PLUGIN_SCANNER_1_0", gstPluginScannerPath.toUtf8()); + setenv("GST_PLUGIN_PATH", gstPluginPath.toUtf8().constData(), 1); + setenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8().constData(), 1); + setenv("GST_PLUGIN_SCANNER", gstPluginScannerPath.toUtf8().constData(), 1); #endif QCoreApplication::setOrganizationName("iDescriptor"); QCoreApplication::setApplicationName("iDescriptor");