main.yml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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: '004'
  14. CEF_BUILD_VERSION_MAC: '4638'
  15. CEF_HASH_MAC_X86_64: '2fe4cc39b1373b85086e4030dedd2a250d5dbbed8c2f8780002d6cd6214b6bc2'
  16. CEF_HASH_MAC_ARM64: '27809aac427b9c97b0dadcab04371c5f8211f36c6f3e1caa00822de89c5ed249'
  17. CEF_BUILD_VERSION_LINUX: '4638'
  18. CEF_BUILD_VERSION_WIN: '4638'
  19. QT_VERSION_MAC: '5.15.2'
  20. QT_HASH_MAC_X86_64: 'eb52d5cad6160a333db0781490f703822688f94cbf75bf753116761653b657ca'
  21. QT_HASH_MAC_ARM64: '8e0f614310e8686b10ff780050caac94ae4bc3ee9e3534e3ccf2300d59088ad0'
  22. QT_VERSION_WIN: '5.15.2'
  23. DEPS_VERSION_MAC: '2022-05-23'
  24. DEPS_HASH_MAC_X86_64: 'e0372850e2c1014301d8a121945ff4778b543f3a768ccfdeda02c3427572cbc3'
  25. DEPS_HASH_MAC_ARM64: '3e9c5d58f558736a62397cd2fc084e0be9cafbc00ef708d31b487f4b03c34ac3'
  26. DEPS_VERSION_WIN: '2022-05-23'
  27. VLC_VERSION_MAC: '3.0.8'
  28. VLC_HASH_MAC: 'e0149ef4a20a19b9ecd87309c2d27787ee3f47dfd47c6639644bc1f6fd95bdf6'
  29. VLC_VERSION_WIN: '3.0.0-git'
  30. TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
  31. TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
  32. RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
  33. RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
  34. YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
  35. YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
  36. YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
  37. YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
  38. jobs:
  39. clang_check:
  40. name: '01 - Code Format Check'
  41. runs-on: [ubuntu-latest]
  42. steps:
  43. - name: 'Checkout'
  44. uses: actions/checkout@v3
  45. with:
  46. submodules: 'recursive'
  47. - name: 'Install clang-format'
  48. run: sudo apt-get install -y clang-format-12
  49. - name: 'Run clang-format'
  50. run: |
  51. ./CI/check-format.sh
  52. ./CI/check-changes.sh
  53. - name: 'Install cmake-format'
  54. run: sudo pip install cmakelang
  55. - name: 'Run cmake-format'
  56. run: |
  57. ./CI/check-cmake.sh
  58. macos_build:
  59. name: '02 - macOS'
  60. runs-on: [macos-12]
  61. strategy:
  62. matrix:
  63. arch: ['x86_64', 'arm64']
  64. if: always()
  65. needs: [clang_check]
  66. env:
  67. MACOSX_DEPLOYMENT_TARGET_X86_64: '10.13'
  68. MACOSX_DEPLOYMENT_TARGET_ARM64: '11.0'
  69. SPARKLE_VERSION: '1.26.0'
  70. SPARKLE_HASH: '8312cbf7528297a49f1b97692c33cb8d33254c396dc51be394e9484e4b6833a0'
  71. BLOCKED_FORMULAS: 'speexdsp curl php composer'
  72. CODESIGN_IDENT: '-'
  73. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
  74. defaults:
  75. run:
  76. shell: bash
  77. working-directory: 'obs-studio'
  78. steps:
  79. - name: 'Checkout'
  80. uses: actions/checkout@v3
  81. with:
  82. submodules: 'recursive'
  83. path: 'obs-studio'
  84. fetch-depth: 0
  85. - name: 'Check for Github Labels'
  86. if: github.event_name == 'pull_request'
  87. run: |
  88. if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
  89. echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
  90. else
  91. echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
  92. fi
  93. echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
  94. - name: 'Restore ccache from cache'
  95. id: ccache-cache
  96. uses: actions/cache@v3
  97. env:
  98. CACHE_NAME: 'ccache-cache'
  99. with:
  100. path: ${{ github.workspace }}/.ccache
  101. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.arch }}-${{ env.CACHE_DATE }}
  102. - name: 'Restore Chromium Embedded Framework from cache'
  103. id: cef-cache
  104. uses: actions/cache@v3
  105. env:
  106. CACHE_NAME: 'cef-cache'
  107. with:
  108. path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_MAC }}_macos_${{ matrix.arch }}
  109. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_MAC }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
  110. - name: 'Restore VLC dependency from cache'
  111. id: vlc-cache
  112. uses: actions/cache@v3
  113. env:
  114. CACHE_NAME: 'vlc-cache'
  115. with:
  116. path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_MAC }}
  117. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_MAC }}-${{ env.CACHE_REVISION }}
  118. - name: 'Restore Sparkle dependency from cache'
  119. id: sparkle-cache
  120. uses: actions/cache@v3
  121. env:
  122. CACHE_NAME: 'sparkle-cache'
  123. with:
  124. path: ${{ github.workspace }}/obs-build-dependencies/obs-deps/lib/Sparkle.framework
  125. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.SPARKLE_VERSION }}-${{ env.CACHE_REVISION }}
  126. - name: 'Setup build environment'
  127. id: setup
  128. run: |
  129. REMOVE_FORMULAS=""
  130. for FORMULA in ${{ env.BLOCKED_FORMULAS }}; do
  131. if [ -d "/usr/local/opt/${FORMULA}" ]; then
  132. REMOVE_FORMULAS="${REMOVE_FORMULAS}${FORMULA} "
  133. fi
  134. done
  135. if [ -n "${REMOVE_FORMULAS}" ]; then
  136. brew uninstall ${REMOVE_FORMULAS}
  137. fi
  138. echo "::set-output name=commitHash::$(git rev-parse --short=9 HEAD)"
  139. - name: 'Install dependencies'
  140. env:
  141. RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
  142. RESTORED_SPARKLE: ${{ steps.sparkle-cache.outputs.cache-hit }}
  143. RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
  144. run: CI/macos/01_install_dependencies.sh --architecture "${{ matrix.arch }}"
  145. - name: 'Install Apple Developer Certificate'
  146. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
  147. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  148. with:
  149. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  150. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  151. - name: 'Set Signing Identity'
  152. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
  153. run: |
  154. echo "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_IDENTITY }}" >> $GITHUB_ENV
  155. echo "BUILD_FOR_DISTRIBUTION=ON" >> $GITHUB_ENV
  156. - name: 'Build OBS'
  157. run: CI/macos/02_build_obs.sh --codesign --architecture "${{ matrix.arch }}"
  158. - name: 'Run tests'
  159. if: ${{ success() && matrix.arch == 'x86_64' }}
  160. run: cmake --build build -t test
  161. - name: 'Create build artifact'
  162. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  163. run: |
  164. CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}"
  165. ARTIFACT_NAME=$(basename $(/usr/bin/find build -type f -name "obs-studio-*.dmg" -depth 1 | head -1))
  166. echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
  167. - name: 'Upload build Artifact'
  168. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  169. uses: actions/upload-artifact@v3
  170. with:
  171. name: 'obs-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  172. path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
  173. linux_build:
  174. name: '02 - Linux'
  175. runs-on: ${{ matrix.ubuntu }}
  176. strategy:
  177. matrix:
  178. ubuntu: ['ubuntu-20.04', 'ubuntu-18.04']
  179. if: always()
  180. needs: [clang_check]
  181. defaults:
  182. run:
  183. shell: bash
  184. working-directory: 'obs-studio'
  185. env:
  186. BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  187. steps:
  188. - name: 'Checkout'
  189. uses: actions/checkout@v3
  190. with:
  191. submodules: 'recursive'
  192. path: 'obs-studio'
  193. fetch-depth: 0
  194. - name: 'Check for Github Labels'
  195. if: github.event_name == 'pull_request'
  196. run: |
  197. if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
  198. echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
  199. else
  200. echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
  201. fi
  202. echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
  203. - name: 'Restore ccache from cache'
  204. id: ccache-cache
  205. uses: actions/cache@v3
  206. env:
  207. CACHE_NAME: 'ccache-cache'
  208. with:
  209. path: ${{ github.workspace }}/.ccache
  210. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.ubuntu }}-${{ env.CACHE_DATE }}
  211. - name: 'Restore Chromium Embedded Framework from cache'
  212. id: cef-cache
  213. uses: actions/cache@v3
  214. env:
  215. CACHE_NAME: 'cef-cache'
  216. with:
  217. path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_LINUX }}_linux64
  218. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_LINUX }}-${{ env.CACHE_REVISION }}
  219. - name: 'Setup build environment'
  220. id: setup
  221. run: |
  222. echo "::set-output name=commitHash::$(git rev-parse --short=9 HEAD)"
  223. - name: 'Install dependencies'
  224. env:
  225. RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
  226. run: CI/linux/01_install_dependencies.sh --disable-pipewire
  227. - name: 'Build OBS'
  228. run: CI/linux/02_build_obs.sh --disable-pipewire
  229. - name: 'Run tests'
  230. if: success()
  231. run: cmake --build build -t test
  232. - name: 'Create build artifact'
  233. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  234. run: |
  235. CI/linux/03_package_obs.sh
  236. ARTIFACT_NAME=$(basename $(/usr/bin/find build -maxdepth 1 -type f -name "obs-studio-*.deb" | sort -rn | head -1))
  237. echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
  238. - name: 'Upload build Artifact'
  239. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  240. uses: actions/upload-artifact@v3
  241. with:
  242. name: 'obs-linux-${{ matrix.ubuntu }}-deb-${{ steps.setup.outputs.commitHash }}'
  243. path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
  244. windows_build:
  245. name: '02 - Windows'
  246. runs-on: [windows-2019]
  247. needs: [clang_check]
  248. if: always()
  249. strategy:
  250. matrix:
  251. arch: [x64, x86]
  252. env:
  253. CMAKE_GENERATOR: 'Visual Studio 16 2019'
  254. CMAKE_SYSTEM_VERSION: '10.0.18363.657'
  255. VIRTUALCAM-GUID: 'A3FCE0F5-3493-419F-958A-ABA1250EC20B'
  256. BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  257. defaults:
  258. run:
  259. working-directory: 'obs-studio'
  260. steps:
  261. - name: 'Checkout'
  262. uses: actions/checkout@v3
  263. with:
  264. submodules: 'recursive'
  265. path: 'obs-studio'
  266. fetch-depth: 0
  267. - name: 'Add msbuild to PATH'
  268. uses: microsoft/[email protected]
  269. - name: 'Check for Github Labels'
  270. if: github.event_name == 'pull_request'
  271. run: |
  272. $LabelFound = try { (Invoke-RestMethod -Authentication 'Bearer' -Token (ConvertTo-SecureString '${{ secrets.GITHUB_TOKEN }}' -AsPlainText) -Uri "${{ github.event.pull_request.url }}" -UseBasicParsing).labels.name.contains("Seeking Testers") } catch { $false }
  273. Write-Output "SEEKING_TESTERS=$(if( $LabelFound -eq $true ) { 1 } else { 0 })" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
  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. Write-Output "::set-output name=commitHash::${CommitHash}"
  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() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  304. run: |
  305. CI/windows/03_package_obs.ps1 -BuildArch ${{ matrix.arch }} -Package
  306. $ArtifactName = Get-ChildItem -filter "OBS-Studio-*-Win-${{ 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() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  310. uses: actions/upload-artifact@v3
  311. with:
  312. name: 'obs-win-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  313. path: '${{ env.FILE_NAME }}'
  314. linux_package:
  315. name: '02 - Flatpak Bundle'
  316. runs-on: [ubuntu-latest]
  317. needs: [clang_check]
  318. if: always()
  319. defaults:
  320. run:
  321. shell: bash
  322. container:
  323. image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08
  324. options: --privileged
  325. steps:
  326. - name: 'Check for Github Labels'
  327. if: github.event_name == 'pull_request'
  328. run: |
  329. if ! /usr/bin/command -v "jq" >/dev/null 2>&1; then sudo dnf install -y -q jq; fi
  330. if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
  331. echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
  332. else
  333. echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
  334. fi
  335. - name: 'Checkout'
  336. uses: actions/checkout@v3
  337. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  338. with:
  339. submodules: 'recursive'
  340. fetch-depth: 0
  341. - name: 'Setup build environment'
  342. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  343. run: |
  344. echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
  345. echo "OBS_GIT_HASH=$(git rev-parse --short=9 HEAD)" >> $GITHUB_ENV
  346. echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
  347. - name: Build Flatpak Manifest
  348. uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
  349. if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
  350. with:
  351. bundle: obs-studio-flatpak-${{ env.OBS_GIT_HASH }}.flatpak
  352. manifest-path: CI/flatpak/com.obsproject.Studio.json
  353. cache-key: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
  354. windows_package:
  355. name: '03 - Windows Installer'
  356. runs-on: [windows-latest]
  357. needs: [windows_build]
  358. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  359. env:
  360. BUILD_FOR_DISTRIBUTION: 'ON'
  361. steps:
  362. - name: 'Checkout'
  363. uses: actions/checkout@v3
  364. - name: Setup Environment
  365. id: setup
  366. run: |
  367. $CommitHash = git rev-parse --short=9 HEAD
  368. Write-Output "::set-output name=commitHash::${CommitHash}"
  369. - name: 'Add msbuild to PATH'
  370. uses: microsoft/[email protected]
  371. - name: 'Download 64-bit artifact'
  372. uses: actions/download-artifact@v3
  373. with:
  374. name: 'obs-win-x64-${{ steps.setup.outputs.commitHash }}'
  375. - name: 'Download 32-bit artifact'
  376. uses: actions/download-artifact@v3
  377. with:
  378. name: 'obs-win-x86-${{ steps.setup.outputs.commitHash }}'
  379. - name: 'Unpack Windows build artifacts'
  380. id: unpack
  381. run: |
  382. if (!(Test-Path install_temp)) {
  383. $null = New-Item -ItemType Directory -Force -Path install_temp
  384. }
  385. Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win-x86.zip" -File)" -DestinationPath install_temp
  386. Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win-x64.zip" -File)" -Force -DestinationPath install_temp
  387. CI/windows/03_package_obs.ps1 -CombinedArchs -Package
  388. $ArtifactName = (Get-ChildItem -filter "OBS-Studio-*-Win-x86+x64.zip" -File).Name
  389. Write-Output "::set-output name=filename::${ArtifactName}"
  390. - name: 'Upload build artifact'
  391. uses: actions/upload-artifact@v3
  392. with:
  393. name: 'obs-windows'
  394. path: '${{ steps.unpack.outputs.filename }}'
  395. macos_release:
  396. name: '03 - macOS notarized image'
  397. runs-on: [macos-12]
  398. needs: [macos_build]
  399. env:
  400. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
  401. BUILD_FOR_DISTRIBUTION: 'ON'
  402. if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
  403. strategy:
  404. matrix:
  405. arch: ['x86_64', 'arm64']
  406. defaults:
  407. run:
  408. shell: bash
  409. steps:
  410. - name: 'Checkout'
  411. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  412. uses: actions/checkout@v3
  413. - name: 'Setup build environment'
  414. id: setup
  415. run: |
  416. echo "::set-output name=commitHash::$(git rev-parse --short=9 HEAD)"
  417. - name: 'Download artifact'
  418. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  419. uses: actions/download-artifact@v3
  420. with:
  421. name: 'obs-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
  422. - name: 'Install Apple Developer Certificate'
  423. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  424. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  425. with:
  426. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  427. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  428. - name: 'Create disk image for distribution'
  429. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  430. env:
  431. CODESIGN_IDENT: ${{ secrets.MACOS_SIGNING_IDENTITY }}
  432. CODESIGN_IDENT_USER: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
  433. CODESIGN_IDENT_PASS: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
  434. run: |
  435. ARTIFACT_NAME=$(/usr/bin/find . -type f -name "obs-studio-*.dmg" -depth 1 | head -1)
  436. CI/macos/03_package_obs.sh --notarize-image ${ARTIFACT_NAME}
  437. echo "FILE_NAME=$(basename ${ARTIFACT_NAME})" >> $GITHUB_ENV
  438. - name: 'Upload build Artifact'
  439. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  440. uses: actions/upload-artifact@v3
  441. with:
  442. name: 'obs-macos-${{ matrix.arch }}-notarized'
  443. path: '${{ github.workspace }}/${{ env.FILE_NAME }}'