Skip to content

Commit 8006d79

Browse files
authored
Appimage build (fix for flameshot-org#4112) (flameshot-org#4146)
1 parent 9891ab0 commit 8006d79

File tree

1 file changed

+113
-132
lines changed

1 file changed

+113
-132
lines changed

.github/workflows/Linux-pack.yml

Lines changed: 113 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -253,138 +253,119 @@ jobs:
253253
${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
254254
overwrite: true
255255

256-
# appimage-pack:
257-
# name: Build appimage on ${{ matrix.config.name }}
258-
# runs-on: ubuntu-latest
259-
# strategy:
260-
# fail-fast: false
261-
# matrix:
262-
# config:
263-
# - {
264-
# name: ubuntu-22.04,
265-
# os: ubuntu,
266-
# symbol: jammy,
267-
# arch: amd64,
268-
# image_repo: quay.io/flameshot-org/ci-building
269-
# }
270-
# container:
271-
# image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
272-
# options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
273-
# steps:
274-
# - name:
275-
# shell: bash
276-
# run: |
277-
# git config --global --add safe.directory "$GITHUB_WORKSPACE"
278-
#
279-
# - name: Checkout Source code
280-
# if: github.event_name == 'push'
281-
# uses: actions/checkout@v4
282-
# with:
283-
# fetch-depth: 0
284-
# ref: master
285-
# - name: Checkout Source code
286-
# if: github.event_name == 'pull_request'
287-
# uses: actions/checkout@v4
288-
# with:
289-
# fetch-depth: 0
290-
# ref: ${{ github.event.pull_request.head.sha }}
291-
# - name: Set env & Print flameshot version
292-
# shell: bash
293-
# run: |
294-
# last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
295-
# git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
296-
# git_hash=$(git rev-parse --short HEAD)
297-
# ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
298-
# echo "=======FLAMESHOT VERSION========"
299-
# echo ${last_committed_tag:1}
300-
# echo "Details: ${ver_info}"
301-
# echo "================================"
302-
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
303-
# echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
304-
# - name: Install Dependencies
305-
# run: |
306-
# sudo apt-get -y -qq update
307-
# sudo apt-get -y --no-install-recommends install \
308-
# python3 \
309-
# python3-pip \
310-
# fuse \
311-
# patchelf \
312-
# cmake \
313-
# extra-cmake-modules \
314-
# build-essential \
315-
# qt5-qmake \
316-
# qtbase5-dev \
317-
# qtbase5-dev-tools \
318-
# qttools5-dev-tools \
319-
# qttools5-dev \
320-
# libqt5dbus5 \
321-
# libqt5network5 \
322-
# libqt5core5a \
323-
# libqt5widgets5 \
324-
# libqt5gui5 \
325-
# libqt5svg5-dev \
326-
# appstream \
327-
# hicolor-icon-theme \
328-
# fcitx-frontend-qt5 \
329-
# openssl \
330-
# ca-certificates \
331-
# jq
332-
#
333-
# - name: Get go-appimage tool
334-
# # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
335-
# # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
336-
# # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
337-
# run: |
338-
# wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool
339-
#
340-
# chmod +x appimagetool
341-
# env:
342-
# APPIMAGETOOL_ARCH: x86_64
343-
# - name: Packaging appimage
344-
# run: |
345-
# set -x
346-
# APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
347-
# mkdir -p ${APPIMAGE_DST_PATH}
348-
#
349-
# cd $GITHUB_WORKSPACE
350-
# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
351-
# make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
352-
#
353-
# $GITHUB_WORKSPACE/appimagetool -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop"
354-
#
355-
# mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts
356-
# cp \
357-
# /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
358-
# ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts/
359-
#
360-
# cp \
361-
# $GITHUB_WORKSPACE/data/img/app/org.flameshot.Flameshot.png \
362-
# ${APPIMAGE_DST_PATH}/
363-
#
364-
# if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
365-
# rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0
366-
# fi
367-
#
368-
# chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*
369-
#
370-
#
371-
# VERSION=${VERSION} $GITHUB_WORKSPACE/appimagetool "${APPIMAGE_DST_PATH}"
372-
# mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
373-
#
374-
#
375-
# - name: SHA256Sum of appimage package
376-
# run: |
377-
# cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
378-
# sha256sum Flameshot-${VERSION}.x86_64.AppImage | tee Flameshot-${VERSION}.x86_64.AppImage.sha256sum
379-
# - name: Artifact Upload
380-
# uses: actions/upload-artifact@v4
381-
# with:
382-
# name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-appimage-x86_64
383-
# path: |
384-
# ${{ github.workspace }}/Flameshot-*.x86_64.AppImage
385-
# ${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
386-
# overwrite: true
387-
#
256+
appimage-pack:
257+
name: Build appimage on ${{ matrix.config.name }}
258+
runs-on: ubuntu-latest
259+
strategy:
260+
fail-fast: false
261+
matrix:
262+
config:
263+
- {
264+
name: ubuntu-22.04,
265+
os: ubuntu,
266+
symbol: jammy,
267+
arch: amd64,
268+
image_repo: quay.io/flameshot-org/ci-building
269+
}
270+
container:
271+
image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
272+
options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
273+
steps:
274+
- name: Configure git safe directory
275+
shell: bash
276+
run: |
277+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
278+
279+
- name: Checkout Source code
280+
if: github.event_name == 'push'
281+
uses: actions/checkout@v4
282+
with:
283+
fetch-depth: 0
284+
# ref: master
285+
286+
- name: Checkout Source code
287+
if: github.event_name == 'pull_request'
288+
uses: actions/checkout@v4
289+
with:
290+
fetch-depth: 0
291+
ref: ${{ github.event.pull_request.head.sha }}
292+
293+
- name: Checkout Source code
294+
if: github.event_name == 'workflow_dispatch'
295+
uses: actions/checkout@v4
296+
with:
297+
ref: ${{ github.sha }}
298+
299+
- name: Set env & Print flameshot version
300+
shell: bash
301+
run: |
302+
last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
303+
git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
304+
git_hash=$(git rev-parse --short HEAD)
305+
ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
306+
echo "=======FLAMESHOT VERSION========"
307+
echo ${last_committed_tag:1}
308+
echo "Details: ${ver_info}"
309+
echo "================================"
310+
# This will allow to build pre-preleases without git tag
311+
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
312+
echo "VERSION=$(cat CMakeLists.txt |grep 'set.*(.*FLAMESHOT_VERSION' | sed 's/[^0-9.]*//' |sed 's/)//g')" >> $GITHUB_ENV
313+
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
314+
315+
- name: Install Dependencies
316+
run: |
317+
sudo apt-get -y -qq update
318+
sudo apt-get -y --no-install-recommends install fuse cmake extra-cmake-modules build-essential qt6-base-dev qt6-tools-dev qt6-tools-dev-tools libqt6svg6-dev qt6-l10n-tools qt6-wayland libgl-dev appstream hicolor-icon-theme openssl ca-certificates jq
319+
320+
- name: Download linuxdeploy
321+
run: |
322+
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
323+
chmod a+x linuxdeploy-x86_64.AppImage
324+
LINUXDEPLOY_BIN=${PWD}/linuxdeploy-x86_64.AppImage
325+
326+
- name: Download linuxdeployqt-plugin-appimage
327+
run: |
328+
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
329+
chmod a+x linuxdeploy-plugin-appimage-x86_64.AppImage
330+
331+
- name: Download linuxdeployqt-plugin-qt
332+
run: |
333+
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
334+
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
335+
336+
- name: Packaging appimage
337+
run: |
338+
set -x
339+
APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
340+
mkdir -p ${APPIMAGE_DST_PATH}
341+
342+
cd $GITHUB_WORKSPACE
343+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
344+
make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
345+
rm -rf ${APPIMAGE_DST_PATH}/usr/include
346+
rm -rf ${APPIMAGE_DST_PATH}/usr/lib
347+
348+
export EXTRA_PLATFORM_PLUGINS="libqwayland-generic.so"
349+
export EXTRA_QT_MODULES="waylandcompositor"
350+
export QMAKE=/usr/lib/qt6/bin/qmake
351+
${PWD}/linuxdeploy-x86_64.AppImage --appdir ${APPIMAGE_DST_PATH} --plugin qt --output appimage
352+
353+
mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
354+
355+
- name: SHA256Sum of appimage package
356+
run: |
357+
cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
358+
sha256sum Flameshot-${VERSION}.x86_64.AppImage | tee Flameshot-${VERSION}.x86_64.AppImage.sha256sum
359+
360+
- name: Artifact Upload
361+
uses: actions/upload-artifact@v4
362+
with:
363+
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-appimage-x86_64
364+
path: |
365+
${{ github.workspace }}/Flameshot-*.x86_64.AppImage
366+
${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
367+
overwrite: true
368+
388369
flatpak-pack:
389370
name: Build flatpak on ubuntu 24.04
390371
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)