push.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. name: Push
  2. run-name: ${{ github.ref_name }} push run 🚀
  3. on:
  4. push:
  5. paths-ignore:
  6. - '**.md'
  7. branches:
  8. - master
  9. - 'release/**'
  10. tags:
  11. - '*'
  12. permissions:
  13. contents: write
  14. jobs:
  15. check-format:
  16. name: Format 🔍
  17. if: github.ref_name == 'master'
  18. uses: ./.github/workflows/check-format.yaml
  19. permissions:
  20. contents: read
  21. build-project:
  22. name: Build 🧱
  23. uses: ./.github/workflows/build-project.yaml
  24. secrets: inherit
  25. permissions:
  26. contents: read
  27. compatibility-validation:
  28. name: Validate Compatibility 🕵️
  29. if: github.ref_name == 'master'
  30. runs-on: ubuntu-22.04
  31. permissions:
  32. checks: write
  33. steps:
  34. - uses: actions/checkout@v3
  35. with:
  36. fetch-depth: 0
  37. - name: Check for Changed Files ✅
  38. uses: ./.github/actions/check-changes
  39. id: checks
  40. with:
  41. baseRef: ${{ github.event.before }}
  42. checkGlob: plugins/win-capture/data/*.json
  43. - name: Check for Invalid Compatibility Data 📉
  44. if: fromJSON(steps.checks.outputs.hasChangedFiles)
  45. uses: ./.github/actions/compatibility-validator
  46. with:
  47. repositorySecret: ${{ github.token }}
  48. services-validation:
  49. name: Validate Services 🕵️
  50. if: github.ref_name == 'master'
  51. runs-on: ubuntu-22.04
  52. permissions:
  53. checks: write
  54. steps:
  55. - uses: actions/checkout@v3
  56. with:
  57. fetch-depth: 0
  58. - name: Check for Changed Files ✅
  59. uses: ./.github/actions/check-changes
  60. id: checks
  61. with:
  62. baseRef: ${{ github.event.before }}
  63. checkGlob: plugins/rtmp-services/data/*.json
  64. - name: Check Services JSON Schema 📉
  65. if: fromJSON(steps.checks.outputs.hasChangedFiles)
  66. uses: ./.github/actions/services-validator
  67. with:
  68. repositorySecret: ${{ github.token }}
  69. runSchemaChecks: true
  70. runServiceChecks: false
  71. update-documentation:
  72. name: Update Documentation 📖
  73. if: github.repository_owner == 'obsproject' && (github.ref_name == 'master' || github.ref_type == 'tag')
  74. runs-on: ubuntu-22.04
  75. steps:
  76. - uses: actions/checkout@v3
  77. with:
  78. fetch-depth: 0
  79. - name: Check for Changed Files ✅
  80. if: github.ref_type != 'tag'
  81. uses: ./.github/actions/check-changes
  82. id: checks
  83. with:
  84. baseRef: ${{ github.event.before }}
  85. checkGlob: '!(cmake*)'
  86. - uses: ./.github/actions/generate-docs
  87. if: github.ref_type == 'tag' || fromJSON(steps.checks.outputs.hasChangedFiles)
  88. with:
  89. disableLinkExtensions: ${{ github.ref_type == 'tag' }}
  90. deploy-documentation:
  91. name: Deploy Documentation to Cloudflare ☁️
  92. if: github.repository_owner == 'obsproject' && github.ref_type == 'tag'
  93. runs-on: ubuntu-22.04
  94. needs: update-documentation
  95. defaults:
  96. run:
  97. shell: bash
  98. environment:
  99. name: cf-pages-deploy
  100. steps:
  101. - name: Get Commit Information 🆔
  102. id: setup
  103. run: |
  104. : Get Commit Hash 🆔
  105. echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
  106. - uses: actions/download-artifact@v3
  107. with:
  108. name: OBS Studio Docs (No Extensions) ${{ steps.setup.outputs.commitHash }}
  109. path: docs
  110. - name: Set Up Redirects 🔄
  111. run: |
  112. : Set Up Redirects 🔄
  113. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  114. echo "/previous/27.2 https://obsproject.com/docs/27.2 302" >> docs/_redirects
  115. echo "/previous/:major.:minor https://:major-:minor.${{ vars.CF_PAGES_PROJECT }}.pages.dev 302" >> docs/_redirects
  116. - name: Publish to Live Page
  117. uses: cloudflare/wrangler-action@4c10c1822abba527d820b29e6333e7f5dac2cabd
  118. with:
  119. workingDirectory: docs
  120. apiToken: ${{ secrets.CF_API_TOKEN }}
  121. accountId: ${{ secrets.CF_ACCOUNT_ID }}
  122. command: pages publish . --project-name=${{ vars.CF_PAGES_PROJECT }} --commit-hash='${{ steps.setup.outputs.commitHash }}'
  123. create-appcast:
  124. name: Create Sparkle Appcast 🎙️
  125. if: github.repository_owner == 'obsproject' && github.ref_type == 'tag'
  126. runs-on: macos-13
  127. needs: build-project
  128. strategy:
  129. fail-fast: false
  130. matrix:
  131. target: [arm64, x86_64]
  132. defaults:
  133. run:
  134. shell: zsh --no-rcs --errexit --pipefail {0}
  135. steps:
  136. - uses: actions/checkout@v3
  137. with:
  138. submodules: recursive
  139. fetch-depth: 0
  140. ref: ${{ github.ref }}
  141. - name: Set Up Environment 🔧
  142. id: setup
  143. run: |
  144. : Set Up Environment 🔧
  145. if (( ${+RUNNER_DEBUG} )) setopt XTRACE
  146. local channel='stable'
  147. if [[ ${GITHUB_REF_NAME} == *(beta|rc)* ]] {
  148. channel='beta'
  149. }
  150. local -A arch_names=(x86_64 intel arm64 apple)
  151. print "cpuName=${arch_names[${{ matrix.target }}]}" >> $GITHUB_OUTPUT
  152. print "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
  153. print "channel=${channel}" >> $GITHUB_OUTPUT
  154. - name: Download Artifact 📥
  155. uses: actions/download-artifact@v3
  156. with:
  157. name: obs-studio-macos-${{ matrix.target }}-${{ steps.setup.outputs.commitHash }}
  158. - name: Generate Appcast 🎙️
  159. id: generate-appcast
  160. uses: ./.github/actions/sparkle-appcast
  161. with:
  162. sparklePrivateKey: ${{ secrets.SPARKLE_PRIVATE_KEY }}
  163. baseImage: ${{ github.workspace }}/obs-studio-*-macos-${{ steps.setup.outputs.cpuName }}.dmg
  164. channel: ${{ steps.setup.outputs.channel }}
  165. count: 1
  166. urlPrefix: 'https://cdn-fastly.obsproject.com/downloads'
  167. customTitle: 'OBS Studio'
  168. customLink: 'https://obsproject.com/'
  169. - name: Upload Artifacts 📡
  170. uses: actions/upload-artifact@v3
  171. with:
  172. name: macos-sparkle-update
  173. path: ${{ github.workspace }}/output
  174. create-release:
  175. name: Create Release 🛫
  176. if: github.ref_type == 'tag'
  177. runs-on: ubuntu-22.04
  178. needs: build-project
  179. defaults:
  180. run:
  181. shell: bash
  182. steps:
  183. - name: Check Release Tag ☑️
  184. id: check
  185. run: |
  186. : Check Release Tag ☑️
  187. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  188. shopt -s extglob
  189. case "${GITHUB_REF_NAME}" in
  190. +([0-9]).+([0-9]).+([0-9]) )
  191. echo 'validTag=true' >> $GITHUB_OUTPUT
  192. echo 'prerelease=false' >> $GITHUB_OUTPUT
  193. echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
  194. ;;
  195. +([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
  196. echo 'validTag=true' >> $GITHUB_OUTPUT
  197. echo 'prerelease=true' >> $GITHUB_OUTPUT
  198. echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
  199. ;;
  200. *) echo 'validTag=false' >> $GITHUB_OUTPUT ;;
  201. esac
  202. - name: Download Build Artifacts 📥
  203. uses: actions/download-artifact@v3
  204. if: ${{ fromJSON(steps.check.outputs.validTag) }}
  205. - name: Rename Files 🏷️
  206. if: fromJSON(steps.check.outputs.validTag)
  207. run: |
  208. : Rename Files 🏷️
  209. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  210. root_dir="${PWD}"
  211. commit_hash="${GITHUB_SHA:0:9}"
  212. macos_arm64_artifact_name="obs-studio-macos-arm64-${commit_hash}"
  213. macos_arm64_dsym_artifact_name="obs-studio-macos-arm64-${commit_hash}-dSYMs"
  214. macos_intel_artifact_name="obs-studio-macos-x86_64-${commit_hash}"
  215. macos_intel_dsym_artifact_name="obs-studio-macos-x86_64-${commit_hash}-dSYMs"
  216. ubuntu_x86_64_artifact_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}"
  217. ubuntu_x86_64_debug_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}-dbgsym"
  218. echo '::group::Renaming Artifacts'
  219. mv -v "${macos_arm64_artifact_name}/"obs-studio-*-macos-apple.dmg \
  220. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-macOS-Apple.dmg
  221. mv -v "${macos_arm64_dsym_artifact_name}/"obs-studio-*-macos-apple-dSYMs.tar.xz \
  222. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-macOS-Apple-dSYMs.tar.xz
  223. mv -v "${macos_intel_artifact_name}/"obs-studio-*-macos-intel.dmg \
  224. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-macOS-Intel.dmg
  225. mv -v "${macos_intel_dsym_artifact_name}/"obs-studio-*-macos-intel-dSYMs.tar.xz \
  226. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-macOS-Intel-dSYMs.tar.xz
  227. mv -v "${ubuntu_x86_64_artifact_name}/"obs-studio-*-x86_64-linux-gnu.deb \
  228. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64.deb
  229. mv -v "${ubuntu_x86_64_debug_name}/"obs-studio-*-x86_64-linux-gnu-dbgsym.ddeb \
  230. "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64-dbsym.ddeb
  231. echo '::endgroup::'
  232. - name: Generate Checksums 🪪
  233. if: fromJSON(steps.check.outputs.validTag)
  234. run: |
  235. : Generate Checksums 🪪
  236. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  237. shopt -s extglob
  238. echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
  239. for file in ${{ github.workspace }}/@(*.deb|*.ddeb|*.dmg|*.tar.xz); do
  240. echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
  241. done
  242. - name: Create Release 🛫
  243. if: fromJSON(steps.check.outputs.validTag)
  244. id: create_release
  245. uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
  246. with:
  247. draft: true
  248. prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }}
  249. tag_name: ${{ steps.check.outputs.version }}
  250. name: OBS Studio ${{ steps.check.outputs.version }}
  251. body_path: ${{ github.workspace }}/CHECKSUMS.txt
  252. files: |
  253. ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-macOS-*.dmg
  254. ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-macOS-*-dSYMs.tar.xz
  255. ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.deb
  256. ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.ddeb