Linux-pack.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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-20.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. steps:
  74. - name: Enable Docker Experimental Features
  75. run: |
  76. echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
  77. mkdir -p ~/.docker
  78. echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
  79. sudo service docker restart
  80. docker version -f '{{.Client.Experimental}}'
  81. docker version -f '{{.Server.Experimental}}'
  82. docker buildx version
  83. - name: Support for ARM via QEMU's user-mode emulation
  84. # Register binfmt_misc entry for qemu-user-static
  85. # https://github.com/multiarch/qemu-user-static
  86. env:
  87. DOCKER_ARCH: ${{ matrix.dist.arch }}
  88. run: |
  89. case ${DOCKER_ARCH} in
  90. amd64|i386)
  91. QEMU_ARCH=
  92. ;;
  93. arm32*)
  94. QEMU_ARCH=arm
  95. ;;
  96. armhf)
  97. QEMU_ARCH=arm
  98. ;;
  99. arm64*)
  100. QEMU_ARCH=aarch64
  101. ;;
  102. *)
  103. QEMU_ARCH=${DOCKER_ARCH}
  104. ;;
  105. esac
  106. if [ -n "${QEMU_ARCH}" ]; then
  107. docker rm $(docker create --volume qemu-user-static:/usr/bin multiarch/qemu-user-static:${QEMU_ARCH} dummy)
  108. docker run --rm --privileged --volume qemu-user-static:/usr/bin:ro multiarch/qemu-user-static:register --persistent yes --credential yes
  109. cat /proc/sys/fs/binfmt_misc/qemu-${QEMU_ARCH}
  110. fi
  111. - name: Checkout Source code
  112. if: github.event_name == 'push'
  113. uses: actions/checkout@v2
  114. with:
  115. fetch-depth: 0
  116. ref: master
  117. - name: Checkout Source code
  118. if: github.event_name == 'pull_request'
  119. uses: actions/checkout@v2
  120. with:
  121. fetch-depth: 0
  122. ref: ${{ github.event.pull_request.head.sha }}
  123. - name: Set env & Print flameshot version
  124. shell: bash
  125. run: |
  126. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  127. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  128. git_hash=$(git rev-parse --short HEAD)
  129. echo "=======FLAMESHOT VERSION========"
  130. echo ${last_committed_tag:1}
  131. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  132. echo "================================"
  133. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  134. - name: Get packpack tool
  135. uses: actions/checkout@v2
  136. with:
  137. repository: ${{ env.PACKPACK_REPO }}
  138. path: tools
  139. ref: multiarch
  140. - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  141. env:
  142. OS: ${{ matrix.dist.os }}
  143. DIST: ${{ matrix.dist.symbol }}
  144. DOCKER_ARCH: ${{ matrix.dist.arch }}
  145. run: |
  146. case ${DOCKER_ARCH} in
  147. arm32v7)
  148. export ARCH=arm/v7
  149. ;;
  150. armhf)
  151. export ARCH=arm/v7
  152. ;;
  153. arm64*)
  154. export ARCH=arm64
  155. ;;
  156. *)
  157. export ARCH=${DOCKER_ARCH}
  158. ;;
  159. esac
  160. cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE
  161. bash $GITHUB_WORKSPACE/tools/packpack
  162. mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_${{ matrix.dist.arch }}.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
  163. - name: In order to unset the registered formats, and unload the binaries
  164. env:
  165. DOCKER_ARCH: ${{ matrix.dist.arch }}
  166. run: |
  167. case ${DOCKER_ARCH} in
  168. amd64|i386)
  169. QEMU_ARCH=
  170. ;;
  171. arm32*)
  172. QEMU_ARCH=arm
  173. ;;
  174. arm64*)
  175. QEMU_ARCH=aarch64
  176. ;;
  177. *)
  178. QEMU_ARCH=${DOCKER_ARCH}
  179. ;;
  180. esac
  181. if [ -n "${QEMU_ARCH}" ]; then
  182. docker run --rm --privileged --volume qemu-user-static:/usr/bin:ro multiarch/qemu-user-static:register --reset
  183. fi
  184. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  185. run: |
  186. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
  187. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb > $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
  188. echo "=============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link============"
  189. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum)
  190. echo "========no operation for you can see link in the log console======="
  191. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  192. run: |
  193. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  194. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb)
  195. echo "======no operation for you can see link in the log console====="
  196. - name: Artifact Upload
  197. uses: actions/upload-artifact@v2
  198. with:
  199. name: Linux-distribution-artifact
  200. path: |
  201. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
  202. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
  203. deb-pack-extra:
  204. name: Build deb on ubuntu-18.04 (extra job to packaging deb)
  205. runs-on: ubuntu-20.04
  206. container:
  207. image: flameshotorg/ci-building-images:ubuntu-bionic
  208. steps:
  209. - name: Checkout Source code
  210. if: github.event_name == 'push'
  211. # Because git version < 2.18(ubuntu 18.04), so only actions/checkout@v1 can be used.
  212. # If you use actions/checkout@v2, you will have no .git folder.
  213. uses: actions/checkout@v1
  214. with:
  215. fetch-depth: 0
  216. ref: master
  217. - name: Checkout Source code
  218. if: github.event_name == 'pull_request'
  219. uses: actions/checkout@v1
  220. with:
  221. fetch-depth: 0
  222. ref: refs/pull/${{ github.event.number }}/head
  223. - name: Set env & Print flameshot version
  224. shell: bash
  225. run: |
  226. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  227. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  228. git_hash=$(git rev-parse --short HEAD)
  229. echo "=======FLAMESHOT VERSION========"
  230. echo ${last_committed_tag:1}
  231. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  232. echo "================================"
  233. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  234. - name: Install dependencies
  235. run: |
  236. apt-get -y -qq update
  237. apt-get -y --no-install-recommends install \
  238. qt5-default \
  239. qttools5-dev-tools \
  240. qttools5-dev \
  241. libqt5dbus5 \
  242. libqt5network5 \
  243. libqt5core5a \
  244. libqt5widgets5 \
  245. libqt5gui5 \
  246. libqt5svg5-dev \
  247. python3 \
  248. python3-pip
  249. - name: Prepare cmake(>=3.13.0)
  250. run: |
  251. apt-get -y autoremove cmake
  252. wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-${CMAKE_ARCH}.tar.gz
  253. tar -xf cmake-${CMAKE_VERSION}-Linux-${CMAKE_ARCH}.tar.gz
  254. cd ./cmake-${CMAKE_VERSION}-Linux-${CMAKE_ARCH}
  255. cp -r bin /usr/
  256. cp -r share /usr/
  257. cp -r doc /usr/share/
  258. cp -r man /usr/share/
  259. cd ..
  260. rm -rf cmake-${CMAKE_VERSION}-Linux-${CMAKE_ARCH} cmake-${CMAKE_VERSION}-Linux-${CMAKE_ARCH}.tar.gz
  261. echo "======CMAKE VERSION======"
  262. cmake --version
  263. echo "========================="
  264. env:
  265. CMAKE_VERSION: "3.19.4"
  266. CMAKE_ARCH: x86_64
  267. - name: Packaging on ubuntu-18.04
  268. run: |
  269. cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE
  270. mkdir -p $GITHUB_WORKSPACE/build
  271. sed -e "/cmake (>= 3.13~),/d" -i $GITHUB_WORKSPACE/debian/control
  272. dpkg-buildpackage -b
  273. cp $GITHUB_WORKSPACE/../${PRODUCT}_*-${RELEASE}_amd64.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb
  274. - name: SHA256Sum of ubuntu-18.04 package(daily build)
  275. run: |
  276. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb
  277. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb > $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb.sha256sum
  278. echo "============ubuntu-18.04 sha256sum download link=============="
  279. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb.sha256sum)
  280. echo "=====no operation for you can see link in the log console====="
  281. - name: Upload ubuntu-18.04 package(daily build)
  282. run: |
  283. echo "===================ubuntu-18.04 download link=================="
  284. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb)
  285. echo "======no operation for you can see link in the log console====="
  286. - name: Artifact Upload
  287. uses: actions/upload-artifact@v2
  288. with:
  289. name: Linux-distribution-artifact
  290. path: |
  291. ${{ github.workspace }}/build/*
  292. rpm-pack:
  293. name: Build rpm on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  294. runs-on: ubuntu-20.04
  295. strategy:
  296. fail-fast: false
  297. matrix:
  298. dist:
  299. - {
  300. name: fedora-33,
  301. os: fedora,
  302. symbol: 33,
  303. arch: x86_64
  304. }
  305. - {
  306. name: fedora-34,
  307. os: fedora,
  308. symbol: 34,
  309. arch: x86_64
  310. }
  311. - {
  312. name: opensuse-leap-15.2,
  313. os: opensuse-leap,
  314. symbol: 15.2,
  315. arch: x86_64
  316. }
  317. steps:
  318. - name: Checkout Source code
  319. if: github.event_name == 'push'
  320. uses: actions/checkout@v2
  321. with:
  322. fetch-depth: 0
  323. ref: master
  324. - name: Checkout Source code
  325. if: github.event_name == 'pull_request'
  326. uses: actions/checkout@v2
  327. with:
  328. fetch-depth: 0
  329. ref: ${{ github.event.pull_request.head.sha }}
  330. - name: Set env & Print flameshot version
  331. shell: bash
  332. run: |
  333. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  334. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  335. git_hash=$(git rev-parse --short HEAD)
  336. echo "=======FLAMESHOT VERSION========"
  337. echo ${last_committed_tag:1}
  338. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  339. echo "================================"
  340. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  341. - name: Get packpack tool
  342. uses: actions/checkout@v2
  343. with:
  344. repository: ${{ env.PACKPACK_REPO }}
  345. path: tools
  346. ref: master
  347. - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
  348. run: |
  349. cp -r $GITHUB_WORKSPACE/packaging/rpm $GITHUB_WORKSPACE
  350. bash $GITHUB_WORKSPACE/tools/packpack
  351. env:
  352. OS: ${{ matrix.dist.os }}
  353. DIST: ${{ matrix.dist.symbol }}
  354. - name: Package Clean
  355. if: matrix.dist.os == 'fedora'
  356. run: |
  357. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debuginfo-*.rpm
  358. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debugsource-*.rpm
  359. rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-*.src.rpm
  360. rm -f ${{ github.workspace }}/build/build.log
  361. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  362. if: matrix.dist.os == 'fedora'
  363. run: |
  364. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm
  365. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm > $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  366. echo "============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link============"
  367. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm.sha256sum)
  368. echo "=======no operation for you can see link in the log console======="
  369. - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  370. if: matrix.dist.os == 'opensuse-leap'
  371. run: |
  372. 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
  373. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
  374. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm > $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  375. echo "============${{ matrix.dist.name }} ${{ matrix.dist.arch }} sha256sum download link==========="
  376. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum)
  377. echo "=======no operation for you can see link in the log console======"
  378. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  379. if: matrix.dist.os == 'fedora'
  380. run: |
  381. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  382. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm)
  383. echo "======no operation for you can see link in the log console====="
  384. - name: Upload ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package(daily build)
  385. if: matrix.dist.os == 'opensuse-leap'
  386. run: |
  387. echo "================${{ matrix.dist.name }} ${{ matrix.dist.arch }} download link==============="
  388. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm)
  389. echo "======no operation for you can see link in the log console====="
  390. - name: Artifact Upload
  391. if: matrix.dist.os == 'fedora'
  392. uses: actions/upload-artifact@v2
  393. with:
  394. name: Linux-distribution-artifact
  395. path: |
  396. ${{ github.workspace }}/build/
  397. - name: Artifact Upload
  398. if: matrix.dist.os == 'opensuse-leap'
  399. uses: actions/upload-artifact@v2
  400. with:
  401. name: Linux-distribution-artifact
  402. path: |
  403. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
  404. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
  405. appimage-pack:
  406. name: Build appimage on ${{ matrix.config.name }}
  407. runs-on: ubuntu-20.04
  408. strategy:
  409. fail-fast: false
  410. matrix:
  411. config:
  412. - {
  413. name: ubuntu-20.04,
  414. os: ubuntu,
  415. symbol: focal,
  416. arch: amd64,
  417. image_repo: flameshotorg/ci-building-images
  418. }
  419. # - {
  420. # name: ubuntu-20.04,
  421. # os: ubuntu,
  422. # symbol: focal,
  423. # arch: arm64,
  424. # image_repo: flameshotorg/ci-building-images
  425. # }
  426. container:
  427. image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
  428. options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
  429. steps:
  430. - name: Checkout Source code
  431. if: github.event_name == 'push'
  432. uses: actions/checkout@v2
  433. with:
  434. fetch-depth: 0
  435. ref: master
  436. - name: Checkout Source code
  437. if: github.event_name == 'pull_request'
  438. uses: actions/checkout@v2
  439. with:
  440. fetch-depth: 0
  441. ref: ${{ github.event.pull_request.head.sha }}
  442. - name: Set env & Print flameshot version
  443. shell: bash
  444. run: |
  445. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  446. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  447. git_hash=$(git rev-parse --short HEAD)
  448. echo "=======FLAMESHOT VERSION========"
  449. echo ${last_committed_tag:1}
  450. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  451. echo "================================"
  452. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  453. - name: Install Dependencies
  454. run: |
  455. sudo apt-get -y -qq update
  456. sudo apt-get -y --no-install-recommends install \
  457. python3 \
  458. python3-pip \
  459. fuse \
  460. patchelf \
  461. cmake \
  462. extra-cmake-modules \
  463. build-essential \
  464. qt5-default \
  465. qttools5-dev-tools \
  466. qttools5-dev \
  467. libqt5dbus5 \
  468. libqt5network5 \
  469. libqt5core5a \
  470. libqt5widgets5 \
  471. libqt5gui5 \
  472. libqt5svg5-dev \
  473. appstream \
  474. hicolor-icon-theme \
  475. fcitx-frontend-qt5 \
  476. openssl \
  477. ca-certificates
  478. - name: Get go-appimage tool
  479. # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
  480. # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
  481. # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
  482. run: |
  483. wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases -O - \
  484. | grep "appimagetool-.*-${APPIMAGETOOL_ARCH}.AppImage" | head -n 1 | cut -d '"' -f 2) -O appimagetool
  485. chmod +x appimagetool
  486. env:
  487. APPIMAGETOOL_ARCH: x86_64
  488. - name: Packaging appimage
  489. run: |
  490. APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
  491. mkdir -p ${APPIMAGE_DST_PATH}
  492. cd $GITHUB_WORKSPACE
  493. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
  494. make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
  495. $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop
  496. mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts
  497. cp \
  498. /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
  499. ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts/
  500. cp \
  501. $GITHUB_WORKSPACE/data/img/app/org.flameshot.Flameshot.png \
  502. ${APPIMAGE_DST_PATH}/
  503. if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
  504. rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0
  505. fi
  506. chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*
  507. VERSION=${VERSION} $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH}
  508. mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
  509. - name: SHA256Sum of appimage package(daily build)
  510. run: |
  511. sha256sum $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
  512. sha256sum $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage > $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage.sha256sum
  513. echo "================appimage sha256sum download link==============="
  514. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage.sha256sum)
  515. echo "======no operation for you can see link in the log console====="
  516. - name: Upload appimage package for daily build
  517. run: |
  518. echo "====================appimage download link====================="
  519. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage)
  520. echo "======no operation for you can see link in the log console====="
  521. - name: Artifact Upload
  522. uses: actions/upload-artifact@v2
  523. with:
  524. name: Linux-distribution-artifact
  525. path: |
  526. ${{ github.workspace }}/Flameshot-*.x86_64.AppImage
  527. ${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
  528. flatpak-pack:
  529. name: Build flatpak on ubuntu-20.04
  530. runs-on: ubuntu-20.04
  531. steps:
  532. - name: Checkout Source code
  533. if: github.event_name == 'push'
  534. uses: actions/checkout@v2
  535. with:
  536. fetch-depth: 0
  537. ref: master
  538. - name: Checkout Source code
  539. if: github.event_name == 'pull_request'
  540. uses: actions/checkout@v2
  541. with:
  542. fetch-depth: 0
  543. ref: ${{ github.event.pull_request.head.sha }}
  544. - name: Set env & Print flameshot version
  545. shell: bash
  546. run: |
  547. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  548. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  549. git_hash=$(git rev-parse --short HEAD)
  550. echo "=======FLAMESHOT VERSION========"
  551. echo ${last_committed_tag:1}
  552. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  553. echo "================================"
  554. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  555. - name: Setup flatpak
  556. run: |
  557. sudo apt-get -y -qq update
  558. sudo apt-get install -y flatpak flatpak-builder
  559. - name: Setup Flathub
  560. run: |
  561. flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  562. flatpak install -y --noninteractive flathub org.kde.Sdk//5.15 org.kde.Platform//5.15
  563. - name: Packaging flatpak
  564. run: |
  565. BUNDLE="org.flameshot.Flameshot_${VERSION}_x86_64.flatpak"
  566. MANIFEST_PATH=$GITHUB_WORKSPACE/packaging/flatpak/org.flameshot.Flameshot.yml
  567. RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo"
  568. APP_ID="org.flameshot.Flameshot"
  569. BRANCH="master"
  570. flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub
  571. flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
  572. mv $GITHUB_WORKSPACE/org.flameshot.Flameshot_${VERSION}_x86_64.flatpak $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak
  573. - name: SHA256Sum of flatpak package(daily build)
  574. run: |
  575. sha256sum $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak
  576. sha256sum $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak > $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak.sha256sum
  577. echo "================flatpak sha256sum download link===================="
  578. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak.sha256sum)
  579. echo "========no operation for you can see link in the log console======="
  580. - name: Upload flatpak package(daily build)
  581. run: |
  582. echo "=====================flatpak download link====================="
  583. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.Flameshot-${VERSION}.x86_64.flatpak)
  584. echo "======no operation for you can see link in the log console====="
  585. - name: Artifact Upload
  586. uses: actions/upload-artifact@v2
  587. with:
  588. name: Linux-distribution-artifact
  589. path: |
  590. ${{ github.workspace }}/org.flameshot.Flameshot-*.x86_64.flatpak
  591. ${{ github.workspace }}/org.flameshot.Flameshot-*.x86_64.flatpak.sha256sum
  592. snap-pack:
  593. name: Build snap on ubuntu-20.04
  594. runs-on: ubuntu-20.04
  595. steps:
  596. - name: Checkout Source code
  597. if: github.event_name == 'push'
  598. uses: actions/checkout@v2
  599. with:
  600. fetch-depth: 0
  601. ref: master
  602. - name: Checkout Source code
  603. if: github.event_name == 'pull_request'
  604. uses: actions/checkout@v2
  605. with:
  606. fetch-depth: 0
  607. ref: ${{ github.event.pull_request.head.sha }}
  608. - name: Set env & Print flameshot version
  609. shell: bash
  610. run: |
  611. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  612. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  613. git_hash=$(git rev-parse --short HEAD)
  614. echo "=======FLAMESHOT VERSION========"
  615. echo ${last_committed_tag:1}
  616. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  617. echo "================================"
  618. echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  619. - name: Packaging snap
  620. uses: snapcore/action-build@v1
  621. id: snapcraft
  622. - name: Rename snap name
  623. shell: bash
  624. run: |
  625. mkdir -p $GITHUB_WORKSPACE/build
  626. cp ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap
  627. - name: SHA256Sum of snap package(daily build)
  628. run: |
  629. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap
  630. sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap > $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap.sha256sum
  631. echo "================snap sha256sum download link=================="
  632. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap.sha256sum)
  633. echo "=====no operation for you can see link in the log console====="
  634. - name: Upload snap package(daily build)
  635. run: |
  636. echo "=======================snap download link======================"
  637. echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.amd64.snap)
  638. echo "======no operation for you can see link in the log console====="
  639. - name: Artifact Upload
  640. uses: actions/upload-artifact@v2
  641. with:
  642. name: Linux-distribution-artifact
  643. path: |
  644. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.amd64.snap
  645. ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.amd64.snap.sha256sum