Linux-pack.yml 25 KB

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