Linux-pack.yml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. name: Packaging(Linux)
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths-ignore:
  7. - 'README.md'
  8. - 'LICENSE'
  9. pull_request:
  10. paths-ignore:
  11. - 'README.md'
  12. - 'LICENSE'
  13. workflow_dispatch:
  14. env:
  15. PRODUCT: flameshot
  16. RELEASE: 1
  17. # dockerfiles, see https://github.com/flameshot-org/flameshot-dockerfiles
  18. # docker images, see https://hub.docker.com/r/flameshotorg/ci-building-images
  19. # flameshotorg/ci-building-images or packpack/packpack
  20. DOCKER_REPO: flameshotorg/ci-building-images
  21. PACKPACK_REPO: flameshot-org/packpack
  22. # available upload services: wetransfer.com, file.io, 0x0.st
  23. UPLOAD_SERVICE: wetransfer.com
  24. jobs:
  25. deb-pack:
  26. name: Build deb on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  27. runs-on: ubuntu-22.04
  28. strategy:
  29. fail-fast: false
  30. matrix:
  31. dist:
  32. - {
  33. name: debian-10,
  34. os: debian,
  35. symbol: buster,
  36. arch: amd64
  37. }
  38. - {
  39. name: debian-10,
  40. os: debian,
  41. symbol: buster,
  42. arch: arm64
  43. }
  44. - {
  45. name: debian-10,
  46. os: debian,
  47. symbol: buster,
  48. arch: armhf
  49. }
  50. - {
  51. name: debian-11,
  52. os: debian,
  53. symbol: bullseye,
  54. arch: amd64
  55. }
  56. - {
  57. name: debian-11,
  58. os: debian,
  59. symbol: bullseye,
  60. arch: arm64
  61. }
  62. - {
  63. name: debian-11,
  64. os: debian,
  65. symbol: bullseye,
  66. arch: armhf
  67. }
  68. - {
  69. name: ubuntu-20.04,
  70. os: ubuntu,
  71. symbol: focal,
  72. arch: amd64
  73. }
  74. - {
  75. name: ubuntu-22.04,
  76. os: ubuntu,
  77. symbol: jammy,
  78. arch: amd64
  79. }
  80. steps:
  81. - name: Enable Docker Experimental Features
  82. run: |
  83. echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
  84. mkdir -p ~/.docker
  85. echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
  86. sudo service docker restart
  87. docker version -f "{{ (index .Server.Components 0).Details.Experimental }}"
  88. docker buildx version
  89. - name: Support for ARM via QEMU's user-mode emulation
  90. # Register binfmt_misc entry for qemu-user-static
  91. # https://github.com/multiarch/qemu-user-static
  92. env:
  93. DOCKER_ARCH: ${{ matrix.dist.arch }}
  94. run: |
  95. case ${DOCKER_ARCH} in
  96. amd64|i386)
  97. QEMU_ARCH=
  98. ;;
  99. arm32*)
  100. QEMU_ARCH=arm
  101. ;;
  102. armhf)
  103. QEMU_ARCH=arm
  104. ;;
  105. arm64*)
  106. QEMU_ARCH=aarch64
  107. ;;
  108. *)
  109. QEMU_ARCH=${DOCKER_ARCH}
  110. ;;
  111. esac
  112. if [ -n "${QEMU_ARCH}" ]; then
  113. sudo apt-get -y -qq update
  114. sudo apt-get -y install qemu binfmt-support qemu-user-static
  115. docker run --rm --privileged multiarch/qemu-user-static --reset --persistent yes --credential yes
  116. cat /proc/sys/fs/binfmt_misc/qemu-${QEMU_ARCH}
  117. fi
  118. - name: Checkout Source code
  119. if: github.event_name == 'push'
  120. uses: actions/checkout@v4
  121. with:
  122. fetch-depth: 0
  123. ref: master
  124. - name: Checkout Source code
  125. if: github.event_name == 'pull_request'
  126. uses: actions/checkout@v4
  127. with:
  128. fetch-depth: 0
  129. ref: ${{ github.event.pull_request.head.sha }}
  130. - name: Set env & Print flameshot version
  131. shell: bash
  132. run: |
  133. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  134. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  135. git_hash=$(git rev-parse --short HEAD)
  136. echo "=======FLAMESHOT VERSION========"
  137. echo ${last_committed_tag:1}
  138. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  139. echo "================================"
  140. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  141. - name: Get packpack tool
  142. uses: actions/checkout@v4
  143. with:
  144. repository: ${{ env.PACKPACK_REPO }}
  145. path: tools
  146. ref: multiarch
  147. - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  148. env:
  149. OS: ${{ matrix.dist.os }}
  150. DIST: ${{ matrix.dist.symbol }}
  151. DOCKER_ARCH: ${{ matrix.dist.arch }}
  152. run: |
  153. case ${DOCKER_ARCH} in
  154. arm32v7)
  155. export ARCH=arm/v7
  156. ;;
  157. armhf)
  158. export ARCH=arm/v7
  159. ;;
  160. arm64*)
  161. export ARCH=arm64
  162. ;;
  163. *)
  164. export ARCH=${DOCKER_ARCH}
  165. ;;
  166. esac
  167. cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE
  168. bash $GITHUB_WORKSPACE/tools/packpack
  169. mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_${{ matrix.dist.arch }}.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
  170. - name: In order to unset the registered formats, and unload the binaries
  171. env:
  172. DOCKER_ARCH: ${{ matrix.dist.arch }}
  173. run: |
  174. case ${DOCKER_ARCH} in
  175. amd64|i386)
  176. QEMU_ARCH=
  177. ;;
  178. arm32*)
  179. QEMU_ARCH=arm
  180. ;;
  181. arm64*)
  182. QEMU_ARCH=aarch64
  183. ;;
  184. *)
  185. QEMU_ARCH=${DOCKER_ARCH}
  186. ;;
  187. esac
  188. if [ -n "${QEMU_ARCH}" ]; then
  189. docker run --rm --privileged --volume qemu-user-static:/usr/bin:ro multiarch/qemu-user-static:register --reset
  190. fi
  191. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  192. run: |
  193. cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
  194. sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb | tee ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
  195. echo "=============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link============"
  196. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum)
  197. echo "========no operation for you can see link in the log console======="
  198. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  199. run: |
  200. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  201. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb)
  202. echo "======no operation for you can see link in the log console====="
  203. - name: Artifact Upload
  204. uses: actions/upload-artifact@v3
  205. with:
  206. name: Linux-distribution-artifact
  207. path: |
  208. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
  209. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
  210. rpm-pack:
  211. name: Build rpm on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  212. runs-on: ubuntu-22.04
  213. strategy:
  214. fail-fast: false
  215. matrix:
  216. dist:
  217. - {
  218. name: fedora-35,
  219. os: fedora,
  220. symbol: 35,
  221. arch: x86_64
  222. }
  223. - {
  224. name: fedora-36,
  225. os: fedora,
  226. symbol: 36,
  227. arch: x86_64
  228. }
  229. - {
  230. name: opensuse-leap-15.2,
  231. os: opensuse-leap,
  232. symbol: 15.2,
  233. arch: x86_64
  234. }
  235. steps:
  236. - name: Checkout Source code
  237. if: github.event_name == 'push'
  238. uses: actions/checkout@v4
  239. with:
  240. fetch-depth: 0
  241. ref: master
  242. - name: Checkout Source code
  243. if: github.event_name == 'pull_request'
  244. uses: actions/checkout@v4
  245. with:
  246. fetch-depth: 0
  247. ref: ${{ github.event.pull_request.head.sha }}
  248. - name: Set env & Print flameshot version
  249. shell: bash
  250. run: |
  251. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  252. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  253. git_hash=$(git rev-parse --short HEAD)
  254. echo "=======FLAMESHOT VERSION========"
  255. echo ${last_committed_tag:1}
  256. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  257. echo "================================"
  258. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  259. - name: Get packpack tool
  260. uses: actions/checkout@v4
  261. with:
  262. repository: ${{ env.PACKPACK_REPO }}
  263. path: tools
  264. ref: master
  265. - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  266. run: |
  267. cp -r $GITHUB_WORKSPACE/packaging/rpm $GITHUB_WORKSPACE
  268. bash $GITHUB_WORKSPACE/tools/packpack
  269. env:
  270. OS: ${{ matrix.dist.os }}
  271. DIST: ${{ matrix.dist.symbol }}
  272. - name: Package Clean
  273. if: matrix.dist.os == 'fedora'
  274. run: |
  275. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debuginfo-*.rpm
  276. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debugsource-*.rpm
  277. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-*.src.rpm
  278. rm -f ${{ github.workspace }}/build/build.log
  279. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  280. if: matrix.dist.os == 'fedora'
  281. run: |
  282. cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
  283. sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}.fc${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  284. echo "============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link============"
  285. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh ${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm.sha256sum)
  286. echo "=======no operation for you can see link in the log console======="
  287. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  288. if: matrix.dist.os == 'opensuse-leap'
  289. run: |
  290. mv $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-lp*.${{ matrix.dist.arch }}.rpm $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
  291. cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
  292. sha256sum ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  293. echo "============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link==========="
  294. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum)
  295. echo "=======no operation for you can see link in the log console======"
  296. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  297. if: matrix.dist.os == 'fedora'
  298. run: |
  299. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  300. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm)
  301. echo "======no operation for you can see link in the log console====="
  302. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  303. if: matrix.dist.os == 'opensuse-leap'
  304. run: |
  305. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  306. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm)
  307. echo "======no operation for you can see link in the log console====="
  308. - name: Artifact Upload
  309. if: matrix.dist.os == 'fedora'
  310. uses: actions/upload-artifact@v3
  311. with:
  312. name: Linux-distribution-artifact
  313. path: |
  314. ${{ github.workspace }}/build/
  315. - name: Artifact Upload
  316. if: matrix.dist.os == 'opensuse-leap'
  317. uses: actions/upload-artifact@v3
  318. with:
  319. name: Linux-distribution-artifact
  320. path: |
  321. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
  322. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  323. appimage-pack:
  324. name: Build appimage on ${{ matrix.config.name }}
  325. runs-on: ubuntu-22.04
  326. strategy:
  327. fail-fast: false
  328. matrix:
  329. config:
  330. - {
  331. name: ubuntu-20.04,
  332. os: ubuntu,
  333. symbol: focal,
  334. arch: amd64,
  335. image_repo: flameshotorg/ci-building-images
  336. }
  337. container:
  338. image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
  339. options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
  340. steps:
  341. - name:
  342. shell: bash
  343. run: |
  344. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  345. - name: Checkout Source code
  346. if: github.event_name == 'push'
  347. uses: actions/checkout@v4
  348. with:
  349. fetch-depth: 0
  350. ref: master
  351. - name: Checkout Source code
  352. if: github.event_name == 'pull_request'
  353. uses: actions/checkout@v4
  354. with:
  355. fetch-depth: 0
  356. ref: ${{ github.event.pull_request.head.sha }}
  357. - name: Set env & Print flameshot version
  358. shell: bash
  359. run: |
  360. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  361. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  362. git_hash=$(git rev-parse --short HEAD)
  363. echo "=======FLAMESHOT VERSION========"
  364. echo ${last_committed_tag:1}
  365. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  366. echo "================================"
  367. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  368. - name: Install Dependencies
  369. run: |
  370. sudo apt-get -y -qq update
  371. sudo apt-get -y --no-install-recommends install \
  372. python3 \
  373. python3-pip \
  374. fuse \
  375. patchelf \
  376. cmake \
  377. extra-cmake-modules \
  378. build-essential \
  379. qt5-default \
  380. qttools5-dev-tools \
  381. qttools5-dev \
  382. libqt5dbus5 \
  383. libqt5network5 \
  384. libqt5core5a \
  385. libqt5widgets5 \
  386. libqt5gui5 \
  387. libqt5svg5-dev \
  388. appstream \
  389. hicolor-icon-theme \
  390. fcitx-frontend-qt5 \
  391. openssl \
  392. ca-certificates \
  393. jq
  394. - name: Get go-appimage tool
  395. # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
  396. # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
  397. # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
  398. run: |
  399. 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
  400. chmod +x appimagetool
  401. env:
  402. APPIMAGETOOL_ARCH: x86_64
  403. - name: Packaging appimage
  404. run: |
  405. set -x
  406. APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
  407. mkdir -p ${APPIMAGE_DST_PATH}
  408. cd $GITHUB_WORKSPACE
  409. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
  410. make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
  411. $GITHUB_WORKSPACE/appimagetool -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop"
  412. mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts
  413. cp \
  414. /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
  415. ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts/
  416. cp \
  417. $GITHUB_WORKSPACE/data/img/app/org.flameshot.Flameshot.png \
  418. ${APPIMAGE_DST_PATH}/
  419. if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
  420. rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0
  421. fi
  422. chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*
  423. VERSION=${VERSION} $GITHUB_WORKSPACE/appimagetool "${APPIMAGE_DST_PATH}"
  424. mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
  425. - name: SHA256Sum of appimage package(daily build)
  426. run: |
  427. cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
  428. sha256sum Flameshot-${VERSION}.x86_64.AppImage | tee Flameshot-${VERSION}.x86_64.AppImage.sha256sum
  429. echo "================appimage sha256sum download link==============="
  430. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh Flameshot-${VERSION}.x86_64.AppImage.sha256sum)
  431. echo "======no operation for you can see link in the log console====="
  432. - name: Upload appimage package for daily build
  433. run: |
  434. echo "====================appimage download link====================="
  435. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage)
  436. echo "======no operation for you can see link in the log console====="
  437. - name: Artifact Upload
  438. uses: actions/upload-artifact@v3
  439. with:
  440. name: Linux-distribution-artifact
  441. path: |
  442. ${{ github.workspace }}/Flameshot-*.x86_64.AppImage
  443. ${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
  444. flatpak-pack:
  445. name: Build flatpak on ubuntu-20.04
  446. runs-on: ubuntu-20.04
  447. steps:
  448. - name: Checkout Source code
  449. if: github.event_name == 'push'
  450. uses: actions/checkout@v4
  451. with:
  452. fetch-depth: 0
  453. ref: master
  454. - name: Checkout Source code
  455. if: github.event_name == 'pull_request'
  456. uses: actions/checkout@v4
  457. with:
  458. fetch-depth: 0
  459. ref: ${{ github.event.pull_request.head.sha }}
  460. - name: Set env & Print flameshot version
  461. shell: bash
  462. run: |
  463. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  464. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  465. git_hash=$(git rev-parse --short HEAD)
  466. echo "=======FLAMESHOT VERSION========"
  467. echo ${last_committed_tag:1}
  468. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  469. echo "================================"
  470. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  471. - name: Setup flatpak
  472. run: |
  473. sudo apt-get -y -qq update
  474. sudo apt-get install -y flatpak flatpak-builder
  475. - name: Setup Flathub
  476. run: |
  477. flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  478. flatpak install -y --noninteractive flathub org.kde.Sdk//5.15 org.kde.Platform//5.15
  479. - name: Packaging flatpak
  480. run: |
  481. BUNDLE="org.flameshot.Flameshot_${VERSION}_x86_64.flatpak"
  482. MANIFEST_PATH=$GITHUB_WORKSPACE/packaging/flatpak/org.flameshot.Flameshot.yml
  483. RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo"
  484. APP_ID="org.flameshot.Flameshot"
  485. BRANCH="master"
  486. flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub
  487. flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
  488. mv $GITHUB_WORKSPACE/org.flameshot.Flameshot_${VERSION}_x86_64.flatpak $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak
  489. - name: SHA256Sum of flatpak package(daily build)
  490. run: |
  491. cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
  492. sha256sum org.flameshot.Flameshot-${VERSION}.x86_64.flatpak | tee org.flameshot.Flameshot-${VERSION}.x86_64.flatpak.sha256sum
  493. echo "================flatpak sha256sum download link===================="
  494. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh org.flameshot.Flameshot-${VERSION}.x86_64.flatpak.sha256sum)
  495. echo "========no operation for you can see link in the log console======="
  496. - name: Upload flatpak package(daily build)
  497. run: |
  498. echo "=====================flatpak download link====================="
  499. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak)
  500. echo "======no operation for you can see link in the log console====="
  501. - name: Artifact Upload
  502. uses: actions/upload-artifact@v3
  503. with:
  504. name: Linux-distribution-artifact
  505. path: |
  506. ${{ github.workspace }}/org.flameshot.Flameshot-*.x86_64.flatpak
  507. ${{ github.workspace }}/org.flameshot.Flameshot-*.x86_64.flatpak.sha256sum
  508. snap-pack:
  509. name: Build snap on ubuntu-20.04
  510. runs-on: ubuntu-20.04
  511. steps:
  512. - name: Checkout Source code
  513. if: github.event_name == 'push'
  514. uses: actions/checkout@v4
  515. with:
  516. fetch-depth: 0
  517. ref: master
  518. - name: Checkout Source code
  519. if: github.event_name == 'pull_request'
  520. uses: actions/checkout@v4
  521. with:
  522. fetch-depth: 0
  523. ref: ${{ github.event.pull_request.head.sha }}
  524. - name: Set env & Print flameshot version
  525. shell: bash
  526. run: |
  527. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  528. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  529. git_hash=$(git rev-parse --short HEAD)
  530. echo "=======FLAMESHOT VERSION========"
  531. echo ${last_committed_tag:1}
  532. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  533. echo "================================"
  534. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  535. - name: Packaging snap
  536. uses: snapcore/action-build@v1
  537. id: snapcraft
  538. with:
  539. snapcraft-args: --enable-experimental-extensions
  540. - name: Rename snap name
  541. shell: bash
  542. run: |
  543. mkdir -p $GITHUB_WORKSPACE/build
  544. cp ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap
  545. - name: SHA256Sum of snap package(daily build)
  546. run: |
  547. cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
  548. sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap | tee ${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap.sha256sum
  549. echo "================snap sha256sum download link=================="
  550. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh ${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap.sha256sum)
  551. echo "=====no operation for you can see link in the log console====="
  552. - name: Upload snap package(daily build)
  553. run: |
  554. echo "=======================snap download link======================"
  555. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap)
  556. echo "======no operation for you can see link in the log console====="
  557. - name: Artifact Upload
  558. uses: actions/upload-artifact@v3
  559. with:
  560. name: Linux-distribution-artifact
  561. path: |
  562. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.amd64.snap
  563. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.amd64.snap.sha256sum