build-desktop-release.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. # This is the main desktop application release workflow for both nightly and beta/stable releases.
  2. name: Build-Desktop-Release
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. build-target:
  7. description: 'Build Target ("nightly"/"beta")'
  8. type: string
  9. required: true
  10. default: "beta"
  11. git-ref:
  12. description: "Release Git Ref(master)"
  13. required: true
  14. default: "master"
  15. is-draft:
  16. description: 'Draft Release? (Beta only, Nightly will always be a non-draft)'
  17. type: boolean
  18. required: true
  19. default: true
  20. is-pre-release:
  21. description: 'Pre Release? (labeled as "PreRelease")'
  22. type: boolean
  23. required: true
  24. default: true
  25. schedule: # Every workday at the 2 P.M. (UTC) we run a scheduled nightly build
  26. - cron: '0 14 * * MON-FRI'
  27. env:
  28. CLOJURE_VERSION: '1.10.1.763'
  29. NODE_VERSION: '16'
  30. jobs:
  31. compile-cljs:
  32. runs-on: ubuntu-18.04
  33. steps:
  34. - name: Check out Git repository
  35. uses: actions/checkout@v2
  36. with:
  37. ref: ${{ github.event.inputs.git-ref }}
  38. - name: Install Node.js, NPM and Yarn
  39. uses: actions/setup-node@v2
  40. with:
  41. node-version: ${{ env.NODE_VERSION }}
  42. - name: Get yarn cache directory path
  43. id: yarn-cache-dir-path
  44. run: echo "::set-output name=dir::$(yarn cache dir)"
  45. - name: Cache yarn cache directory
  46. uses: actions/cache@v2
  47. id: yarn-cache
  48. with:
  49. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  50. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  51. restore-keys: |
  52. ${{ runner.os }}-yarn-
  53. - name: Setup Java JDK
  54. uses: actions/[email protected]
  55. with:
  56. java-version: 1.8
  57. - name: Cache clojure deps
  58. uses: actions/cache@v2
  59. with:
  60. path: |
  61. ~/.m2/repository
  62. ~/.gitlibs
  63. key: ${{ runner.os }}-clojure-lib-${{ hashFiles('**/deps.edn') }}
  64. - name: Setup clojure
  65. uses: DeLaGuardo/[email protected]
  66. with:
  67. cli: ${{ env.CLOJURE_VERSION }}
  68. - name: Retrieve tag version
  69. id: ref
  70. run: |
  71. pkgver=$(node ./scripts/get-pkg-version.js "${{ github.event.inputs.build-target }}")
  72. echo ::set-output name=version::$pkgver
  73. - name: Update Nightly APP Version
  74. if: ${{ github.event.inputs.build-target == 'nightly' || github.event_name == 'schedule' }}
  75. run: |
  76. sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs
  77. - name: Compile CLJS
  78. run: yarn install && gulp build && yarn cljs:release-electron
  79. - name: Update APP Version
  80. run: |
  81. sed -i 's/"version": "0.0.1"/"version": "${{ steps.ref.outputs.version }}"/g' ./package.json
  82. working-directory: ./static
  83. - name: Display Package.json
  84. run: cat ./package.json
  85. working-directory: ./static
  86. - name: Save VERSION file
  87. run: echo "${{ steps.ref.outputs.version }}" > ./VERSION
  88. working-directory: ./static
  89. - name: List Files
  90. run: ls -al
  91. working-directory: ./static
  92. - name: Cache Static File
  93. uses: actions/upload-artifact@v2
  94. with:
  95. name: static
  96. path: static
  97. build-linux:
  98. runs-on: ubuntu-18.04
  99. needs: [ compile-cljs ]
  100. steps:
  101. - name: Download The Static Asset
  102. uses: actions/download-artifact@v2
  103. with:
  104. name: static
  105. path: static
  106. - name: Retrieve tag version
  107. id: ref
  108. run: |
  109. pkgver=$(cat ./static/VERSION)
  110. echo ::set-output name=version::$pkgver
  111. - name: Install Node.js, NPM and Yarn
  112. uses: actions/setup-node@v2
  113. with:
  114. node-version: ${{ env.NODE_VERSION }}
  115. # - name: Cache Node Modules
  116. # uses: actions/cache@v2
  117. # with:
  118. # path: |
  119. # **/node_modules
  120. # key: ${{ runner.os }}-node-modules
  121. - name: Build/Release Electron App
  122. run: yarn install && yarn electron:make
  123. working-directory: ./static
  124. - name: Save artifacts
  125. run: |
  126. mkdir -p builds
  127. # NOTE: save VERSION file to builds directory
  128. cp static/VERSION ./builds/VERSION
  129. mv static/out/make/*-*.AppImage ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.AppImage
  130. mv static/out/make/zip/linux/x64/*-linux-x64-*.zip ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.zip
  131. - name: Upload Artifact
  132. uses: actions/upload-artifact@v2
  133. with:
  134. name: logseq-linux-builds
  135. path: builds
  136. build-windows:
  137. runs-on: windows-latest
  138. needs: [ compile-cljs ]
  139. steps:
  140. - name: Download The Static Asset
  141. uses: actions/download-artifact@v2
  142. with:
  143. name: static
  144. path: static
  145. - name: Retrieve tag version
  146. id: ref
  147. run: |
  148. $env:PkgVer=$(cat ./static/VERSION)
  149. echo "::set-output name=version::$env:PkgVer"
  150. - name: Install Node.js, NPM and Yarn
  151. uses: actions/setup-node@v2
  152. with:
  153. node-version: ${{ env.NODE_VERSION }}
  154. # - name: Cache Node Modules
  155. # uses: actions/cache@v2
  156. # with:
  157. # path: |
  158. # **/node_modules
  159. # key: ${{ runner.os }}-node-modules
  160. - name: Deps Electron app
  161. run: yarn install
  162. working-directory: ./static
  163. - name: Fix Deps Electron app
  164. run: yarn run postinstall
  165. working-directory: ./static/node_modules/dugite/
  166. - name: Build/Release Electron app
  167. run: yarn electron:make
  168. working-directory: ./static
  169. env:
  170. CSC_LINK: ${{ secrets.CSC_LINK }}
  171. CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
  172. - name: Save Artifact
  173. run: |
  174. mkdir builds
  175. mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-win-x64-${{ steps.ref.outputs.version }}.exe
  176. - name: Upload Artifact
  177. uses: actions/upload-artifact@v2
  178. with:
  179. name: logseq-win64-builds
  180. path: builds
  181. build-macos-x64:
  182. needs: [ compile-cljs ]
  183. runs-on: macos-11
  184. steps:
  185. - name: Download The Static Asset
  186. uses: actions/download-artifact@v2
  187. with:
  188. name: static
  189. path: static
  190. - name: Retrieve tag version
  191. id: ref
  192. run: |
  193. pkgver=$(cat ./static/VERSION)
  194. echo ::set-output name=version::$pkgver
  195. - name: List Static Files
  196. run: ls -al ./static
  197. - name: Install Node.js, NPM and Yarn
  198. uses: actions/setup-node@v2
  199. with:
  200. node-version: ${{ env.NODE_VERSION }}
  201. - name: Get yarn cache directory path
  202. id: yarn-cache-dir-path
  203. run: echo "::set-output name=dir::$(yarn cache dir)"
  204. - name: Cache yarn cache directory
  205. uses: actions/cache@v2
  206. id: yarn-cache
  207. with:
  208. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  209. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  210. restore-keys: |
  211. ${{ runner.os }}-yarn-
  212. - name: Signing By Apple Developer ID
  213. uses: apple-actions/import-codesign-certs@v1
  214. with:
  215. p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
  216. p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
  217. # - name: Cache Node Modules
  218. # uses: actions/cache@v2
  219. # with:
  220. # path: |
  221. # **/node_modules
  222. # key: ${{ runner.os }}-node-modules
  223. - name: Build/Release Electron App for x64
  224. run: yarn install && yarn electron:make
  225. working-directory: ./static
  226. env:
  227. APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
  228. APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
  229. APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
  230. - name: Save x64 artifacts
  231. run: |
  232. mkdir -p builds
  233. mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.dmg
  234. mv static/out/make/zip/darwin/x64/*.zip ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.zip
  235. - name: Upload Artifact
  236. uses: actions/upload-artifact@v2
  237. with:
  238. name: logseq-darwin-x64-builds
  239. path: builds
  240. build-macos-arm64:
  241. needs: [ compile-cljs ]
  242. runs-on: macos-11
  243. steps:
  244. - name: Download The Static Asset
  245. uses: actions/download-artifact@v2
  246. with:
  247. name: static
  248. path: static
  249. - name: Retrieve tag version
  250. id: ref
  251. run: |
  252. pkgver=$(cat ./static/VERSION)
  253. echo ::set-output name=version::$pkgver
  254. - name: Install Node.js, NPM and Yarn
  255. uses: actions/setup-node@v2
  256. with:
  257. node-version: ${{ env.NODE_VERSION }}
  258. - name: Get yarn cache directory path
  259. id: yarn-cache-dir-path
  260. run: echo "::set-output name=dir::$(yarn cache dir)"
  261. - name: Cache yarn cache directory
  262. uses: actions/cache@v2
  263. id: yarn-cache
  264. with:
  265. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  266. key: ${{ runner.os }}-arm64-yarn-${{ hashFiles('**/yarn.lock') }}
  267. restore-keys: |
  268. ${{ runner.os }}-arm64-yarn-
  269. - name: Signing By Apple Developer ID
  270. uses: apple-actions/import-codesign-certs@v1
  271. with:
  272. p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
  273. p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
  274. # - name: Cache Node Modules
  275. # uses: actions/cache@v2
  276. # with:
  277. # path: |
  278. # **/node_modules
  279. # key: ${{ runner.os }}-node-modules
  280. - name: Build/Release Electron App for arm64
  281. run: yarn install && yarn electron:make-macos-arm64
  282. working-directory: ./static
  283. env:
  284. APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
  285. APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
  286. APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
  287. - name: Save arm64 artifacts
  288. run: |
  289. mkdir -p builds
  290. mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.dmg
  291. mv static/out/make/zip/darwin/arm64/*.zip ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.zip
  292. - name: Upload Artifact
  293. uses: actions/upload-artifact@v2
  294. with:
  295. name: logseq-darwin-arm64-builds
  296. path: builds
  297. nightly-release:
  298. if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly' }}
  299. needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows ]
  300. runs-on: ubuntu-18.04
  301. steps:
  302. - name: Download MacOS x64 Artifacts
  303. uses: actions/download-artifact@v2
  304. with:
  305. name: logseq-darwin-x64-builds
  306. path: ./
  307. - name: Download MacOS arm64 Artifacts
  308. uses: actions/download-artifact@v2
  309. with:
  310. name: logseq-darwin-arm64-builds
  311. path: ./
  312. - name: Download The Linux Artifacts
  313. uses: actions/download-artifact@v2
  314. with:
  315. name: logseq-linux-builds
  316. path: ./
  317. - name: Download The Windows Artifact
  318. uses: actions/download-artifact@v2
  319. with:
  320. name: logseq-win64-builds
  321. path: ./
  322. - name: Generate SHA256 checksums
  323. run: |
  324. sha256sum *-darwin-* > SHA256SUMS.txt
  325. sha256sum *-win-* >> SHA256SUMS.txt
  326. sha256sum *-linux-* >> SHA256SUMS.txt
  327. cat SHA256SUMS.txt
  328. - name: List files
  329. run: ls -rl
  330. - name: Update Nightly Release
  331. uses: andelf/nightly-release@main
  332. env:
  333. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  334. with:
  335. tag_name: nightly
  336. name: 'Desktop APP Nightly Release $$'
  337. draft: false
  338. prerelease: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.is-pre-release) || (github.event_name == 'schedule')}}
  339. body: |
  340. This is a nightly release of the Logseq desktop app.
  341. It's unstable compared to the official releases, **use it with caution**!
  342. files: |
  343. ./SHA256SUMS.txt
  344. ./*.zip
  345. ./*.dmg
  346. ./*.exe
  347. ./*.AppImage
  348. release:
  349. # NOTE: For now, we only have beta channel to be released on Github
  350. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target != 'nightly' }}
  351. needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows ]
  352. runs-on: ubuntu-18.04
  353. steps:
  354. - name: Download MacOS x64 Artifacts
  355. uses: actions/download-artifact@v2
  356. with:
  357. name: logseq-darwin-x64-builds
  358. path: ./
  359. - name: Download MacOS arm64 Artifacts
  360. uses: actions/download-artifact@v2
  361. with:
  362. name: logseq-darwin-arm64-builds
  363. path: ./
  364. - name: Download The Linux Artifacts
  365. uses: actions/download-artifact@v2
  366. with:
  367. name: logseq-linux-builds
  368. path: ./
  369. - name: Download The Windows Artifact
  370. uses: actions/download-artifact@v2
  371. with:
  372. name: logseq-win64-builds
  373. path: ./
  374. - name: List files
  375. run: ls -rl
  376. - name: Retrieve tag version
  377. id: ref
  378. run: |
  379. pkgver=$(cat VERSION)
  380. echo ::set-output name=version::$pkgver
  381. - name: Generate SHA256 checksums
  382. run: |
  383. sha256sum *-darwin-* > SHA256SUMS.txt
  384. sha256sum *-win-* >> SHA256SUMS.txt
  385. sha256sum *-linux-* >> SHA256SUMS.txt
  386. cat SHA256SUMS.txt
  387. - name: Create Release Draft
  388. uses: softprops/action-gh-release@v1
  389. env:
  390. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  391. with:
  392. tag_name: ${{ steps.ref.outputs.version }}
  393. name: Desktop APP ${{ steps.ref.outputs.version }} (Beta Testing)
  394. body: "TODO: Fill this changelog. Sorry for the inconvenience!"
  395. draft: ${{ github.event.inputs.is-draft }}
  396. prerelease: ${{ github.event.inputs.is-pre-release }}
  397. files: |
  398. ./VERSION
  399. ./SHA256SUMS.txt
  400. ./*.zip
  401. ./*.dmg
  402. ./*.exe
  403. ./*.AppImage