main.yml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. name: 'BUILD'
  2. on:
  3. push:
  4. paths-ignore: ['**.md']
  5. branches:
  6. - master
  7. - 'release/**'
  8. tags: ['*']
  9. pull_request:
  10. paths-ignore: ['**.md']
  11. branches: [master]
  12. env:
  13. CACHE_REVISION: '006'
  14. CEF_BUILD_VERSION_MAC: '5060'
  15. CEF_HASH_MAC_X86_64: '88b950aa0bfc001061c35e7f1f3fefba856a6afb35e38b2b7b42ddd8dd239182'
  16. CEF_HASH_MAC_ARM64: '98679b92eea6ea9959ac5aa54f46ca60681d8a86c768c35f496dbdd409bf0642'
  17. CEF_BUILD_VERSION_LINUX: '5060'
  18. CEF_BUILD_VERSION_WIN: '5060'
  19. QT_VERSION_MAC: '6.4.3'
  20. QT_HASH_MAC_X86_64: '8f5e1a865310898635d34b92e6d93c99c62f39289a17d6db140e776ba9b2e455'
  21. QT_HASH_MAC_ARM64: '0011e2395afbb02aaa5e8641c4486680e30decc60e063ca5a73d6faf3649e723'
  22. QT_HASH_MAC_UNIVERSAL: '5bcbb8fee4b70a26912e04a62960c615153828eac66b9f0bcb0b30529193ca6e'
  23. QT_VERSION_WIN: '6.4.3'
  24. DEPS_VERSION_MAC: '2023-03-20'
  25. DEPS_HASH_MAC_X86_64: 'bd4d3866c2e4b630410ff29b3f31a2553844af60b30fa0306d35d80a70f903ba'
  26. DEPS_HASH_MAC_ARM64: '90078e2141818a37def7ebdceb3dcde71dc4adc1ce81d6e31ba21916f85c77bf'
  27. DEPS_VERSION_WIN: '2023-03-20'
  28. VLC_VERSION_MAC: '3.0.8'
  29. VLC_HASH_MAC: 'e0149ef4a20a19b9ecd87309c2d27787ee3f47dfd47c6639644bc1f6fd95bdf6'
  30. VLC_VERSION_WIN: '3.0.0-git'
  31. TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
  32. TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
  33. RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
  34. RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
  35. YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
  36. YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
  37. YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
  38. YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
  39. jobs:
  40. clang_check:
  41. name: '01 - Code Format Check'
  42. runs-on: [ubuntu-22.04]
  43. steps:
  44. - name: 'Checkout'
  45. uses: actions/checkout@v3
  46. with:
  47. submodules: 'recursive'
  48. - name: 'Install clang-format'
  49. run: sudo apt-get install -y clang-format-13
  50. - name: 'Run clang-format'
  51. run: |
  52. ./CI/check-format.sh
  53. ./CI/check-changes.sh
  54. - name: 'Install cmake-format'
  55. run: sudo pip install cmakelang
  56. - name: 'Run cmake-format'
  57. run: |
  58. ./CI/check-cmake.sh
  59. config:
  60. name: '01 - Configure Build Jobs'
  61. runs-on: [ubuntu-22.04]
  62. outputs:
  63. create_artifacts: ${{ steps.config.outputs.create_artifacts }}
  64. cache_date: ${{ steps.config.outputs.cache_date }}
  65. steps:
  66. - name: 'Configure Build Jobs'
  67. id: config
  68. run: |
  69. if [[ "${{ github.event_name == 'pull_request' }}" == "true" ]]; then
  70. echo "create_artifacts=${{ contains(github.event.pull_request.labels.*.name, 'Seeking Testers') }}" >> $GITHUB_OUTPUT
  71. else
  72. echo 'create_artifacts=true' >> $GITHUB_OUTPUT
  73. fi
  74. echo "cache_date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
  75. macos_build:
  76. name: '02 - macOS'
  77. runs-on: [macos-12]
  78. strategy:
  79. matrix:
  80. arch: ['x86_64', 'arm64']
  81. if: always()
  82. needs: [config, clang_check]
  83. env:
  84. MACOSX_DEPLOYMENT_TARGET_X86_64: '10.15'
  85. MACOSX_DEPLOYMENT_TARGET_ARM64: '11.0'
  86. SPARKLE_VERSION: '2.3.2'
  87. SPARKLE_HASH: '2b3fe6918ca20a83729aad34f8f693a678b714a17d33b5f13ca2d25edfa7eed3'
  88. SPARKLE_APPCAST_URL: 'https://obsproject.com/osx_update/updates_${{ matrix.arch }}_v2.xml'
  89. SPARKLE_PUBLIC_KEY: 'HQ5/Ba9VHOuEWaM0jtVjZzgHKFJX9YTl+HNVpgNF0iM='
  90. BLOCKED_FORMULAS: 'speexdsp curl php composer'
  91. CODESIGN_IDENT: '-'
  92. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
  93. defaults:
  94. run:
  95. shell: bash
  96. working-directory: 'obs-studio'
  97. steps:
  98. - name: 'Checkout'
  99. uses: actions/checkout@v3
  100. with:
  101. submodules: 'recursive'
  102. path: 'obs-studio'
  103. fetch-depth: 0
  104. - name: 'Restore ccache from cache'
  105. id: ccache-cache
  106. uses: actions/cache@v3
  107. env:
  108. CACHE_NAME: 'ccache-cache'
  109. with:
  110. path: ${{ github.workspace }}/.ccache
  111. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.arch }}-${{ needs.config.outputs.cache_date }}
  112. - name: 'Restore Chromium Embedded Framework from cache'
  113. id: cef-cache
  114. uses: actions/cache@v3
  115. env:
  116. CACHE_NAME: 'cef-cache'
  117. with:
  118. path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_MAC }}_macos_${{ matrix.arch }}
  119. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_MAC }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
  120. - name: 'Restore VLC dependency from cache'
  121. id: vlc-cache
  122. uses: actions/cache@v3
  123. env:
  124. CACHE_NAME: 'vlc-cache'
  125. with:
  126. path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_MAC }}
  127. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_MAC }}-${{ env.CACHE_REVISION }}
  128. - name: 'Restore Sparkle dependency from cache'
  129. id: sparkle-cache
  130. uses: actions/cache@v3
  131. env:
  132. CACHE_NAME: 'sparkle-cache'
  133. with:
  134. path: ${{ github.workspace }}/obs-build-dependencies/obs-deps/lib/Sparkle.framework
  135. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.SPARKLE_VERSION }}-${{ env.CACHE_REVISION }}
  136. - name: 'Setup build environment'
  137. id: setup
  138. run: |
  139. REMOVE_FORMULAS=""
  140. for FORMULA in ${{ env.BLOCKED_FORMULAS }}; do
  141. if [ -d "/usr/local/opt/${FORMULA}" ]; then
  142. REMOVE_FORMULAS="${REMOVE_FORMULAS}${FORMULA} "
  143. fi
  144. done
  145. if [ -n "${REMOVE_FORMULAS}" ]; then
  146. brew uninstall ${REMOVE_FORMULAS}
  147. fi
  148. echo "commitHash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
  149. - name: 'Install dependencies'
  150. env:
  151. RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
  152. RESTORED_SPARKLE: ${{ steps.sparkle-cache.outputs.cache-hit }}
  153. RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
  154. run: CI/macos/01_install_dependencies.sh --architecture "${{ matrix.arch }}"
  155. - name: 'Install Apple Developer Certificate'
  156. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
  157. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  158. with:
  159. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  160. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  161. - name: 'Set Signing Identity'
  162. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
  163. run: |
  164. echo "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_IDENTITY }}" >> $GITHUB_ENV
  165. echo "BUILD_FOR_DISTRIBUTION=ON" >> $GITHUB_ENV
  166. - name: 'Build OBS'
  167. run: CI/macos/02_build_obs.sh --codesign --architecture "${{ matrix.arch }}"
  168. - name: 'Create build artifact'
  169. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  170. run: |
  171. CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}"
  172. ARTIFACT_NAME=$(basename $(/usr/bin/find build -type f -name "obs-studio-*.dmg" -depth 1 | head -1))
  173. echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
  174. - name: 'Upload build Artifact'
  175. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  176. uses: actions/upload-artifact@v3
  177. with:
  178. name: 'obs-studio-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  179. path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
  180. linux_build:
  181. name: '02 - Linux'
  182. runs-on: ${{ matrix.ubuntu }}
  183. strategy:
  184. matrix:
  185. ubuntu: ['ubuntu-20.04', 'ubuntu-22.04']
  186. if: always()
  187. needs: [config, clang_check]
  188. defaults:
  189. run:
  190. shell: bash
  191. working-directory: 'obs-studio'
  192. env:
  193. BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  194. steps:
  195. - name: 'Checkout'
  196. uses: actions/checkout@v3
  197. with:
  198. submodules: 'recursive'
  199. path: 'obs-studio'
  200. fetch-depth: 0
  201. - name: 'Restore ccache from cache'
  202. id: ccache-cache
  203. uses: actions/cache@v3
  204. env:
  205. CACHE_NAME: 'ccache-cache'
  206. with:
  207. path: ${{ github.workspace }}/.ccache
  208. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.ubuntu }}-${{ needs.config.outputs.cache_date }}
  209. - name: 'Restore Chromium Embedded Framework from cache'
  210. id: cef-cache
  211. uses: actions/cache@v3
  212. env:
  213. CACHE_NAME: 'cef-cache'
  214. with:
  215. path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_LINUX }}_linux64
  216. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_LINUX }}-${{ env.CACHE_REVISION }}
  217. - name: 'Setup build environment'
  218. id: setup
  219. run: |
  220. echo "commitHash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
  221. - name: 'Install dependencies'
  222. env:
  223. RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
  224. run: CI/linux/01_install_dependencies.sh --disable-pipewire
  225. - name: 'Build OBS'
  226. run: CI/linux/02_build_obs.sh --disable-pipewire
  227. - name: 'Run tests'
  228. if: success()
  229. run: cmake --build build -t test
  230. - name: 'Create build artifact'
  231. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  232. run: |
  233. CI/linux/03_package_obs.sh
  234. ARTIFACT_NAME=$(basename $(/usr/bin/find build -maxdepth 1 -type f -name "obs-studio-*.deb" | sort -rn | head -1))
  235. echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
  236. echo "DEBUG_FILE_NAME=${ARTIFACT_NAME//.deb/-dbgsym.ddeb}" >> $GITHUB_ENV
  237. - name: 'Upload build Artifact'
  238. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  239. uses: actions/upload-artifact@v3
  240. with:
  241. name: 'obs-studio-${{ matrix.ubuntu }}-${{ steps.setup.outputs.commitHash }}'
  242. path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
  243. - name: 'Upload debug symbol Artifact'
  244. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  245. uses: actions/upload-artifact@v3
  246. with:
  247. name: 'obs-studio-${{ matrix.ubuntu }}-${{ steps.setup.outputs.commitHash }}-dbgsym'
  248. path: '${{ github.workspace }}/obs-studio/build/${{ env.DEBUG_FILE_NAME }}'
  249. windows_build:
  250. name: '02 - Windows'
  251. runs-on: [windows-2022]
  252. needs: [config, clang_check]
  253. if: always()
  254. strategy:
  255. matrix:
  256. arch: [x64, x86]
  257. env:
  258. CMAKE_GENERATOR: 'Visual Studio 17 2022'
  259. CMAKE_SYSTEM_VERSION: '10.0.18363.657'
  260. VIRTUALCAM-GUID: 'A3FCE0F5-3493-419F-958A-ABA1250EC20B'
  261. BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  262. defaults:
  263. run:
  264. working-directory: 'obs-studio'
  265. steps:
  266. - name: 'Checkout'
  267. uses: actions/checkout@v3
  268. with:
  269. submodules: 'recursive'
  270. path: 'obs-studio'
  271. fetch-depth: 0
  272. - name: 'Add msbuild to PATH'
  273. uses: microsoft/[email protected]
  274. - name: 'Restore VLC dependency from cache'
  275. id: vlc-cache
  276. uses: actions/cache@v3
  277. env:
  278. CACHE_NAME: 'vlc-cache'
  279. with:
  280. path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_WIN }}
  281. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_WIN }}-${{ env.CACHE_REVISION }}
  282. - name: 'Restore Chromium Embedded Framework from cache'
  283. id: cef-cache
  284. uses: actions/cache@v3
  285. env:
  286. CACHE_NAME: 'cef-cache'
  287. with:
  288. path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_WIN }}_windows_${{ matrix.arch }}
  289. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
  290. - name: Setup Environment
  291. id: setup
  292. run: |
  293. $CommitHash = git rev-parse --short=9 HEAD
  294. "commitHash=${CommitHash}" >> $env:GITHUB_OUTPUT
  295. - name: 'Install dependencies'
  296. env:
  297. RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
  298. RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
  299. run: CI/windows/01_install_dependencies.ps1 -BuildArch ${{ matrix.arch }}
  300. - name: 'Build OBS'
  301. run: CI/windows/02_build_obs.ps1 -BuildArch ${{ matrix.arch }}
  302. - name: 'Create build artifact'
  303. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  304. run: |
  305. CI/windows/03_package_obs.ps1 -BuildArch ${{ matrix.arch }} -Package
  306. $ArtifactName = Get-ChildItem -filter "obs-studio-*-windows-${{ matrix.arch }}.zip" -File
  307. Write-Output "FILE_NAME=${ArtifactName}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
  308. - name: 'Upload build artifact'
  309. if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }}
  310. uses: actions/upload-artifact@v3
  311. with:
  312. name: 'obs-studio-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  313. path: '${{ env.FILE_NAME }}'
  314. linux_package:
  315. name: '02 - Flatpak'
  316. runs-on: [ubuntu-latest]
  317. needs: [config, clang_check]
  318. defaults:
  319. run:
  320. shell: bash
  321. container:
  322. image: bilelmoussaoui/flatpak-github-actions:kde-6.4
  323. options: --privileged
  324. steps:
  325. - name: 'Checkout'
  326. uses: actions/checkout@v3
  327. with:
  328. submodules: 'recursive'
  329. fetch-depth: 0
  330. - name: 'Setup build environment'
  331. run: |
  332. git config --global --add safe.directory $GITHUB_WORKSPACE
  333. echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
  334. echo "OBS_GIT_HASH=$(git rev-parse --short=9 HEAD)" >> $GITHUB_ENV
  335. echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
  336. - name: Build Flatpak Manifest
  337. uses: flatpak/flatpak-github-actions/flatpak-builder@v5
  338. with:
  339. build-bundle: ${{ fromJSON(needs.config.outputs.create_artifacts) }}
  340. bundle: obs-studio-flatpak-${{ env.OBS_GIT_HASH }}.flatpak
  341. manifest-path: CI/flatpak/com.obsproject.Studio.json
  342. cache-key: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
  343. windows_package:
  344. name: '03 - Windows Installer'
  345. runs-on: [windows-latest]
  346. needs: [windows_build]
  347. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  348. env:
  349. BUILD_FOR_DISTRIBUTION: 'ON'
  350. steps:
  351. - name: 'Checkout'
  352. uses: actions/checkout@v3
  353. - name: Setup Environment
  354. id: setup
  355. run: |
  356. $CommitHash = git rev-parse --short=9 HEAD
  357. "commitHash=${CommitHash}" >> $env:GITHUB_OUTPUT
  358. - name: 'Add msbuild to PATH'
  359. uses: microsoft/[email protected]
  360. - name: 'Download 64-bit artifact'
  361. uses: actions/download-artifact@v3
  362. with:
  363. name: 'obs-studio-windows-x64-${{ steps.setup.outputs.commitHash }}'
  364. - name: 'Download 32-bit artifact'
  365. uses: actions/download-artifact@v3
  366. with:
  367. name: 'obs-studio-windows-x86-${{ steps.setup.outputs.commitHash }}'
  368. - name: 'Unpack Windows build artifacts'
  369. id: unpack
  370. run: |
  371. if (!(Test-Path install_temp)) {
  372. $null = New-Item -ItemType Directory -Force -Path install_temp
  373. }
  374. Expand-Archive -Path "$(Get-ChildItem -filter "obs-studio-*-windows-x86.zip" -File)" -DestinationPath install_temp
  375. Expand-Archive -Path "$(Get-ChildItem -filter "obs-studio-*-windows-x64.zip" -File)" -Force -DestinationPath install_temp
  376. CI/windows/03_package_obs.ps1 -CombinedArchs -Package
  377. $ArtifactName = (Get-ChildItem -filter "obs-studio-*-windows-x86+x64.zip" -File).Name
  378. "filename=${ArtifactName}" >> $env:GITHUB_OUTPUT
  379. - name: 'Upload build artifact'
  380. uses: actions/upload-artifact@v3
  381. with:
  382. name: 'obs-studio-windows-installer'
  383. path: '${{ steps.unpack.outputs.filename }}'
  384. macos_release:
  385. name: '03 - macOS notarized image'
  386. runs-on: [macos-12]
  387. needs: [macos_build]
  388. env:
  389. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
  390. BUILD_FOR_DISTRIBUTION: 'ON'
  391. HAVE_SPARKLE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY != '' }}
  392. outputs:
  393. run_sparkle: ${{ steps.sparkle_check.outputs.run_sparkle }}
  394. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  395. strategy:
  396. matrix:
  397. arch: ['x86_64', 'arm64']
  398. defaults:
  399. run:
  400. shell: bash
  401. steps:
  402. - name: 'Checkout'
  403. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  404. uses: actions/checkout@v3
  405. - name: 'Setup build environment'
  406. id: setup
  407. run: |
  408. echo "commitHash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
  409. - name: 'Determine if Sparkle should run'
  410. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  411. id: sparkle_check
  412. run: |
  413. echo 'run_sparkle=${{ env.HAVE_SPARKLE_KEY }}' >> $GITHUB_OUTPUT
  414. - name: 'Download artifact'
  415. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  416. uses: actions/download-artifact@v3
  417. with:
  418. name: 'obs-studio-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  419. - name: 'Install Apple Developer Certificate'
  420. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  421. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  422. with:
  423. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  424. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  425. - name: 'Create disk image for distribution'
  426. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  427. env:
  428. CODESIGN_IDENT: ${{ secrets.MACOS_SIGNING_IDENTITY }}
  429. CODESIGN_IDENT_USER: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
  430. CODESIGN_IDENT_PASS: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
  431. run: |
  432. ARTIFACT_NAME=$(/usr/bin/find . -type f -name "obs-studio-*.dmg" -depth 1 | head -1)
  433. CI/macos/03_package_obs.sh --notarize-image ${ARTIFACT_NAME}
  434. echo "FILE_NAME=$(basename ${ARTIFACT_NAME})" >> $GITHUB_ENV
  435. - name: 'Upload build Artifact'
  436. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  437. uses: actions/upload-artifact@v3
  438. with:
  439. name: 'obs-studio-macos-${{ matrix.arch }}-notarized'
  440. path: '${{ github.workspace }}/${{ env.FILE_NAME }}'
  441. macos_sparkle:
  442. name: '04 - macOS Sparkle Updates'
  443. runs-on: [macos-12]
  444. needs: [macos_release]
  445. if: fromJSON(needs.macos_release.outputs.run_sparkle)
  446. strategy:
  447. matrix:
  448. arch: ['x86_64', 'arm64']
  449. env:
  450. SPARKLE_VERSION: '2.3.2'
  451. SPARKLE_HASH: '2b3fe6918ca20a83729aad34f8f693a678b714a17d33b5f13ca2d25edfa7eed3'
  452. defaults:
  453. run:
  454. shell: bash
  455. steps:
  456. - name: 'Checkout'
  457. uses: actions/checkout@v3
  458. with:
  459. path: 'repo'
  460. ref: ${{ github.ref }}
  461. - name: 'Download artifact'
  462. uses: actions/download-artifact@v3
  463. with:
  464. name: 'obs-studio-macos-${{ matrix.arch }}-notarized'
  465. path: 'artifacts'
  466. - name: 'Install Python requirements'
  467. run: pip3 install requests xmltodict
  468. - name: 'Install Brew requirements'
  469. run: brew install coreutils pandoc
  470. - name: 'Setup Sparkle'
  471. run: |
  472. curl -L "https://github.com/sparkle-project/Sparkle/releases/download/${{ env.SPARKLE_VERSION }}/Sparkle-${{ env.SPARKLE_VERSION }}.tar.xz" -o Sparkle.tar.xz
  473. if [[ '${{ env.SPARKLE_HASH }}' != "$(sha256sum Sparkle.tar.xz | cut -d " " -f 1)" ]]; then
  474. echo "Sparkle download hash does not match!"
  475. exit 1
  476. fi
  477. mkdir sparkle && cd sparkle
  478. tar -xf ../Sparkle.tar.xz
  479. - name: 'Setup folder structure'
  480. run: |
  481. mkdir builds
  482. mkdir -p output/appcasts/stable
  483. mkdir -p output/sparkle_deltas/${{ matrix.arch }}
  484. - name: 'Determine branch and tag'
  485. id: branch
  486. run: |
  487. pushd repo
  488. GIT_TAG="$(git describe --tags --abbrev=0)"
  489. if [[ ${GIT_TAG} == *'beta'* || ${GIT_TAG} == *'rc'* ]]; then
  490. echo "branch=beta" >> $GITHUB_OUTPUT
  491. echo "deltas=0" >> $GITHUB_OUTPUT
  492. else
  493. echo "branch=stable" >> $GITHUB_OUTPUT
  494. echo "deltas=1" >> $GITHUB_OUTPUT
  495. fi
  496. # Write tag description to file
  497. git tag -l --format='%(contents)' ${GIT_TAG} >> ../notes.rst
  498. - name: 'Download existing Appcast and builds'
  499. run: python3 repo/CI/macos/appcast_download.py --branch "${{ steps.branch.outputs.branch }}" --max-old-versions ${{ steps.branch.outputs.deltas }}
  500. - name: 'Prepare release notes'
  501. run: |
  502. # Insert underline at line 2 to turn first line into heading
  503. sed -i '' '2i\'$'\n''###################################################' notes.rst
  504. pandoc -f rst -t html notes.rst -o output/appcasts/notes_${{ steps.branch.outputs.branch }}.html
  505. - name: 'Setup Sparkle key'
  506. run: echo -n "${{ secrets.SPARKLE_PRIVATE_KEY }}" >> eddsa_private.key
  507. - name: 'Generate Appcast'
  508. run: |
  509. mv artifacts/*.dmg builds/
  510. ./sparkle/bin/generate_appcast \
  511. --verbose \
  512. --ed-key-file ./eddsa_private.key \
  513. --download-url-prefix "https://cdn-fastly.obsproject.com/downloads/" \
  514. --full-release-notes-url "https://obsproject.com/osx_update/notes_${{ steps.branch.outputs.branch }}.html" \
  515. --maximum-versions 0 \
  516. --maximum-deltas ${{ steps.branch.outputs.deltas }} \
  517. --channel "${{ steps.branch.outputs.branch }}" builds/
  518. # Move deltas, if any
  519. if compgen -G "builds/*.delta" > /dev/null; then
  520. mv builds/*.delta output/sparkle_deltas/${{ matrix.arch }}
  521. fi
  522. # Move appcasts
  523. mv builds/*.xml output/appcasts/
  524. - name: 'Create 1.x Appcast'
  525. run: python3 repo/CI/macos/appcast_convert.py
  526. - name: 'Upload Appcast and Deltas'
  527. uses: actions/upload-artifact@v3
  528. with:
  529. name: 'macos-sparkle-updates'
  530. path: '${{ github.workspace }}/output'