build-desktop-release.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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"/"non-release")'
  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: Upload Sentry Sourcemaps (beta only)
  93. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
  94. run: |
  95. curl -sL https://sentry.io/get-cli/ | bash
  96. release_name="logseq@${{ steps.ref.outputs.version }}"
  97. sentry-cli releases new "${release_name}"
  98. sentry-cli releases files "${release_name}" upload-sourcemaps --ext map --ext js ./static/js --url-prefix '~/static/js'
  99. sentry-cli releases finalize "${release_name}"
  100. env:
  101. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  102. SENTRY_ORG: logseq
  103. SENTRY_PROJECT: logseq
  104. - name: Cache Static File
  105. uses: actions/upload-artifact@v2
  106. with:
  107. name: static
  108. path: static
  109. build-linux:
  110. runs-on: ubuntu-18.04
  111. needs: [ compile-cljs ]
  112. steps:
  113. - name: Download The Static Asset
  114. uses: actions/download-artifact@v2
  115. with:
  116. name: static
  117. path: static
  118. - name: Retrieve tag version
  119. id: ref
  120. run: |
  121. pkgver=$(cat ./static/VERSION)
  122. echo ::set-output name=version::$pkgver
  123. - name: Install Node.js, NPM and Yarn
  124. uses: actions/setup-node@v2
  125. with:
  126. node-version: ${{ env.NODE_VERSION }}
  127. # - name: Cache Node Modules
  128. # uses: actions/cache@v2
  129. # with:
  130. # path: |
  131. # **/node_modules
  132. # key: ${{ runner.os }}-node-modules
  133. - name: Build/Release Electron App
  134. run: yarn install && yarn electron:make
  135. working-directory: ./static
  136. - name: Save artifacts
  137. run: |
  138. mkdir -p builds
  139. # NOTE: save VERSION file to builds directory
  140. cp static/VERSION ./builds/VERSION
  141. mv static/out/make/*-*.AppImage ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.AppImage
  142. mv static/out/make/zip/linux/x64/*-linux-x64-*.zip ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.zip
  143. - name: Upload Artifact
  144. uses: actions/upload-artifact@v2
  145. with:
  146. name: logseq-linux-builds
  147. path: builds
  148. build-windows:
  149. runs-on: windows-latest
  150. needs: [ compile-cljs ]
  151. steps:
  152. - name: Download The Static Asset
  153. uses: actions/download-artifact@v2
  154. with:
  155. name: static
  156. path: static
  157. - name: Retrieve tag version
  158. id: ref
  159. run: |
  160. $env:PkgVer=$(cat ./static/VERSION)
  161. echo "::set-output name=version::$env:PkgVer"
  162. - name: Install Node.js, NPM and Yarn
  163. uses: actions/setup-node@v2
  164. with:
  165. node-version: ${{ env.NODE_VERSION }}
  166. # - name: Cache Node Modules
  167. # uses: actions/cache@v2
  168. # with:
  169. # path: |
  170. # **/node_modules
  171. # key: ${{ runner.os }}-node-modules
  172. - name: Deps Electron app
  173. run: yarn install
  174. working-directory: ./static
  175. - name: Fix Deps Electron app
  176. run: yarn run postinstall
  177. working-directory: ./static/node_modules/dugite/
  178. - name: Build/Release Electron app
  179. run: yarn electron:make
  180. working-directory: ./static
  181. env:
  182. CSC_LINK: ${{ secrets.CSC_LINK }}
  183. CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
  184. - name: Save Artifact
  185. run: |
  186. mkdir builds
  187. mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-win-x64-${{ steps.ref.outputs.version }}.exe
  188. - name: Upload Artifact
  189. uses: actions/upload-artifact@v2
  190. with:
  191. name: logseq-win64-builds
  192. path: builds
  193. build-macos-x64:
  194. needs: [ compile-cljs ]
  195. runs-on: macos-11
  196. steps:
  197. - name: Download The Static Asset
  198. uses: actions/download-artifact@v2
  199. with:
  200. name: static
  201. path: static
  202. - name: Retrieve tag version
  203. id: ref
  204. run: |
  205. pkgver=$(cat ./static/VERSION)
  206. echo ::set-output name=version::$pkgver
  207. - name: List Static Files
  208. run: ls -al ./static
  209. - name: Install Node.js, NPM and Yarn
  210. uses: actions/setup-node@v2
  211. with:
  212. node-version: ${{ env.NODE_VERSION }}
  213. - name: Get yarn cache directory path
  214. id: yarn-cache-dir-path
  215. run: echo "::set-output name=dir::$(yarn cache dir)"
  216. - name: Cache yarn cache directory
  217. uses: actions/cache@v2
  218. id: yarn-cache
  219. with:
  220. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  221. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  222. restore-keys: |
  223. ${{ runner.os }}-yarn-
  224. - name: Signing By Apple Developer ID
  225. uses: apple-actions/import-codesign-certs@v1
  226. with:
  227. p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
  228. p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
  229. # - name: Cache Node Modules
  230. # uses: actions/cache@v2
  231. # with:
  232. # path: |
  233. # **/node_modules
  234. # key: ${{ runner.os }}-node-modules
  235. - name: Build/Release Electron App for x64
  236. run: yarn install && yarn electron:make
  237. working-directory: ./static
  238. env:
  239. APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
  240. APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
  241. APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
  242. - name: Save x64 artifacts
  243. run: |
  244. mkdir -p builds
  245. mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.dmg
  246. mv static/out/make/zip/darwin/x64/*.zip ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.zip
  247. - name: Upload Artifact
  248. uses: actions/upload-artifact@v2
  249. with:
  250. name: logseq-darwin-x64-builds
  251. path: builds
  252. build-macos-arm64:
  253. needs: [ compile-cljs ]
  254. runs-on: macos-11
  255. steps:
  256. - name: Download The Static Asset
  257. uses: actions/download-artifact@v2
  258. with:
  259. name: static
  260. path: static
  261. - name: Retrieve tag version
  262. id: ref
  263. run: |
  264. pkgver=$(cat ./static/VERSION)
  265. echo ::set-output name=version::$pkgver
  266. - name: Install Node.js, NPM and Yarn
  267. uses: actions/setup-node@v2
  268. with:
  269. node-version: ${{ env.NODE_VERSION }}
  270. - name: Get yarn cache directory path
  271. id: yarn-cache-dir-path
  272. run: echo "::set-output name=dir::$(yarn cache dir)"
  273. - name: Cache yarn cache directory
  274. uses: actions/cache@v2
  275. id: yarn-cache
  276. with:
  277. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  278. key: ${{ runner.os }}-arm64-yarn-${{ hashFiles('**/yarn.lock') }}
  279. restore-keys: |
  280. ${{ runner.os }}-arm64-yarn-
  281. - name: Signing By Apple Developer ID
  282. uses: apple-actions/import-codesign-certs@v1
  283. with:
  284. p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
  285. p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
  286. # - name: Cache Node Modules
  287. # uses: actions/cache@v2
  288. # with:
  289. # path: |
  290. # **/node_modules
  291. # key: ${{ runner.os }}-node-modules
  292. - name: Fetch deps and fix dugit arch for arm64
  293. run: yarn install --ignore-platform && cd node_modules/dugite && npm_config_arch=arm64 node script/download-git.js
  294. working-directory: ./static
  295. - name: Build/Release Electron App for arm64
  296. run: yarn electron:make-macos-arm64
  297. working-directory: ./static
  298. env:
  299. APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
  300. APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
  301. APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
  302. - name: Save arm64 artifacts
  303. run: |
  304. mkdir -p builds
  305. mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.dmg
  306. mv static/out/make/zip/darwin/arm64/*.zip ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.zip
  307. - name: Upload Artifact
  308. uses: actions/upload-artifact@v2
  309. with:
  310. name: logseq-darwin-arm64-builds
  311. path: builds
  312. # reuse workflow via workflow_call
  313. build-android:
  314. uses: logseq/logseq/.github/workflows/build-android.yml@master
  315. with:
  316. build-target: "${{ github.event.inputs.build-target }}"
  317. secrets:
  318. ANDROID_KEYSTORE: "${{ secrets.ANDROID_KEYSTORE }}"
  319. ANDROID_KEYSTORE_PASSWORD: "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}"
  320. SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
  321. nightly-release:
  322. if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly' }}
  323. needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows, build-android ]
  324. runs-on: ubuntu-18.04
  325. steps:
  326. - name: Download MacOS x64 Artifacts
  327. uses: actions/download-artifact@v2
  328. with:
  329. name: logseq-darwin-x64-builds
  330. path: ./
  331. - name: Download MacOS arm64 Artifacts
  332. uses: actions/download-artifact@v2
  333. with:
  334. name: logseq-darwin-arm64-builds
  335. path: ./
  336. - name: Download The Linux Artifacts
  337. uses: actions/download-artifact@v2
  338. with:
  339. name: logseq-linux-builds
  340. path: ./
  341. - name: Download The Windows Artifact
  342. uses: actions/download-artifact@v2
  343. with:
  344. name: logseq-win64-builds
  345. path: ./
  346. - name: Download Android Artifacts
  347. uses: actions/download-artifact@v2
  348. with:
  349. name: logseq-android-builds
  350. path: ./
  351. - name: Generate SHA256 checksums
  352. run: |
  353. sha256sum *-darwin-* > SHA256SUMS.txt
  354. sha256sum *-win-* >> SHA256SUMS.txt
  355. sha256sum *-linux-* >> SHA256SUMS.txt
  356. sha256sum *.apk >> SHA256SUMS.txt
  357. cat SHA256SUMS.txt
  358. - name: List files
  359. run: ls -rl
  360. - name: Update Nightly Release
  361. uses: andelf/nightly-release@main
  362. env:
  363. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  364. with:
  365. tag_name: nightly
  366. name: 'Desktop/Android APP Nightly Release $$'
  367. draft: false
  368. prerelease: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.is-pre-release) || (github.event_name == 'schedule')}}
  369. body: |
  370. This is a nightly release of the Logseq desktop app.
  371. It's unstable compared to the official releases, **use it with caution**!
  372. files: |
  373. ./SHA256SUMS.txt
  374. ./*.zip
  375. ./*.dmg
  376. ./*.exe
  377. ./*.AppImage
  378. ./*.apk
  379. release:
  380. # NOTE: For now, we only have beta channel to be released on Github
  381. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
  382. needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows, build-android ]
  383. runs-on: ubuntu-18.04
  384. steps:
  385. - name: Download MacOS x64 Artifacts
  386. uses: actions/download-artifact@v2
  387. with:
  388. name: logseq-darwin-x64-builds
  389. path: ./
  390. - name: Download MacOS arm64 Artifacts
  391. uses: actions/download-artifact@v2
  392. with:
  393. name: logseq-darwin-arm64-builds
  394. path: ./
  395. - name: Download The Linux Artifacts
  396. uses: actions/download-artifact@v2
  397. with:
  398. name: logseq-linux-builds
  399. path: ./
  400. - name: Download The Windows Artifact
  401. uses: actions/download-artifact@v2
  402. with:
  403. name: logseq-win64-builds
  404. path: ./
  405. - name: Download Android Artifacts
  406. uses: actions/download-artifact@v2
  407. with:
  408. name: logseq-android-builds
  409. path: ./
  410. - name: List files
  411. run: ls -rl
  412. - name: Retrieve tag version
  413. id: ref
  414. run: |
  415. pkgver=$(cat VERSION)
  416. echo ::set-output name=version::$pkgver
  417. - name: Generate SHA256 checksums
  418. run: |
  419. sha256sum *-darwin-* > SHA256SUMS.txt
  420. sha256sum *-win-* >> SHA256SUMS.txt
  421. sha256sum *-linux-* >> SHA256SUMS.txt
  422. sha256sum *.apk >> SHA256SUMS.txt
  423. cat SHA256SUMS.txt
  424. - name: Create Release Draft
  425. uses: softprops/action-gh-release@v1
  426. env:
  427. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  428. with:
  429. tag_name: ${{ steps.ref.outputs.version }}
  430. name: Desktop/Android APP ${{ steps.ref.outputs.version }} (Beta Testing)
  431. body: "TODO: Fill this changelog. Sorry for the inconvenience!"
  432. draft: ${{ github.event.inputs.is-draft }}
  433. prerelease: ${{ github.event.inputs.is-pre-release }}
  434. files: |
  435. ./VERSION
  436. ./SHA256SUMS.txt
  437. ./*.zip
  438. ./*.dmg
  439. ./*.exe
  440. ./*.AppImage
  441. ./*.apk