From 49c80b82494382d2a3c46ac44946592bc5c30ca8 Mon Sep 17 00:00:00 2001 From: Lawrence37 <45837045+Lawrence37@users.noreply.github.com> Date: Thu, 11 Nov 2021 07:56:48 -0800 Subject: [PATCH] GitHub Action for building AppImage (#6374) Add AppImage build to GitHub workflow --- .github/workflows/appimage.yml | 120 +++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/workflows/appimage.yml diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 000000000..2f048456d --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,120 @@ +name: Build AppImage +on: + push: + branches: + - dev + pull_request: + branches: + - dev + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Checkout source + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install dependencies + run: | + echo "Running apt update." + sudo apt update + echo "Installing dependencies with apt." + DEBIAN_FRONTEND=noninteractive sudo apt install -y cmake libgtk-3-dev libgtkmm-3.0-dev liblensfun-dev librsvg2-dev liblcms2-dev libfftw3-dev libiptcdata0-dev libtiff5-dev libcanberra-gtk3-dev liblensfun-bin + - name: Configure build + run: | + echo "Getting branch name." + BRANCH="$(git branch --show-current)" + echo "Branch name is '$BRANCH'." + echo "Making build directory." + mkdir build + echo "Changing working directory to the build directory." + cd build + echo "Running CMake configure." + cmake \ + -DCMAKE_BUILD_TYPE="release" \ + -DCACHE_NAME_SUFFIX="5-$BRANCH-AppImage" \ + -DPROC_TARGET_NUMBER="1" \ + -DBUILD_BUNDLE="ON" \ + -DBUNDLE_BASE_INSTALL_DIR="/" \ + -DOPTION_OMP="ON" \ + -DWITH_LTO="OFF" \ + -DWITH_PROF="OFF" \ + -DWITH_SAN="OFF" \ + -DWITH_SYSTEM_KLT="OFF" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLENSFUNDBDIR="../share/lensfun/version_1" \ + .. + - name: Build RawTherapee + working-directory: ./build + run: | + echo "Running make install." + make -j$(nproc) install DESTDIR=AppDir/usr/bin + echo "Moving usr/bin/share to usr/share." + mv AppDir/usr/bin/share AppDir/usr/ + - name: Include Lensfun + run: | + echo "Updating Lensfun database." + lensfun-update-data + echo "Creating Lensfun directory in the build directory." + mkdir -p build/AppDir/usr/share/lensfun + echo "Copying Lensfun database to the build directory." + cp -R ~/.local/share/lensfun/updates/* build/AppDir/usr/share/lensfun/ + - name: Download AppImage tools + working-directory: ./build + run: | + echo "Downloading linuxdeploy." + curl --location 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' > linuxdeploy-x86_64.AppImage + echo "Downloading GTK plugin for linuxdeploy." + curl --location 'https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh' > linuxdeploy-plugin-gtk.sh + echo "Setting execute bit on all AppImage tools." + chmod u+x linuxdeploy-* + - name: Package AppImage + working-directory: ./build + run: | + echo "Getting RawTherapee version." + export VERSION="$(grep -m 1 '^Version: .*$' AboutThisBuild.txt | sed 's/^Version: \(.\+\)$/\1/')" + echo "Version is '$VERSION'." + echo "Generating AppImage file name." + FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')" + export OUTPUT="RawTherapee-$FILTERED_VERSION-x86_64.AppImage" + echo "AppImage file name will be '$OUTPUT'." + echo "Packaging AppImage." + ./linuxdeploy-x86_64.AppImage \ + --appimage-extract-and-run \ + --appdir AppDir \ + --plugin gtk \ + --output appimage + echo "Recording RawTherapee version." + echo "RT_VERSION=$VERSION" >> $GITHUB_ENV + echo "Recording AppImage file name." + echo "APPIMAGE_NAME=$OUTPUT" >> $GITHUB_ENV + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{env.APPIMAGE_NAME}} + path: ${{github.workspace}}/build/${{env.APPIMAGE_NAME}} + - name: Prepare for publishing + run: | + echo "Setting dev AppImage file name." + APPIMAGE_DEV_NAME="RawTherapee-dev-x86_64.AppImage" + echo "dev AppImage file name is '$APPIMAGE_DEV_NAME'." + echo "Renaming dev AppImage." + cp "build/$APPIMAGE_NAME" "$APPIMAGE_DEV_NAME" + echo "Recording dev AppImage file name." + echo "APPIMAGE_DEV_NAME=$APPIMAGE_DEV_NAME" >> $GITHUB_ENV + echo "Setting dev AppImage version file name." + APPIMAGE_DEV_VERSION_NAME="RawTherapee-dev-x86_64-version.txt" + echo "dev AppImage version file name is '$APPIMAGE_DEV_VERSION_NAME'." + echo "Creating dev AppImage version file." + echo "$RT_VERSION" > "$APPIMAGE_DEV_VERSION_NAME" + echo "Recording dev AppImage version file name." + echo "APPIMAGE_DEV_VERSION_NAME=$APPIMAGE_DEV_VERSION_NAME" >> $GITHUB_ENV + - name: Publish artifacts + uses: softprops/action-gh-release@v1 + if: ${{github.ref == 'refs/heads/dev'}} + with: + tag_name: nightly-github-actions + files: | + ${{env.APPIMAGE_DEV_NAME}} + ${{env.APPIMAGE_DEV_VERSION_NAME}}