Linux-pack.yml 29 KB

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