release.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. name: Release job
  2. on:
  3. workflow_dispatch:
  4. inputs: {}
  5. push:
  6. branches: [ master ]
  7. paths-ignore:
  8. - '.github/**'
  9. - '*.yml'
  10. - '*.json'
  11. - '*.config'
  12. - '*.md'
  13. concurrency: release
  14. env:
  15. POWERSHELL_TELEMETRY_OPTOUT: 1
  16. DOTNET_CLI_TELEMETRY_OPTOUT: 1
  17. RYUJINX_BASE_VERSION: "1.1"
  18. RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "master"
  19. RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "Ryujinx"
  20. RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "release-channel-master"
  21. jobs:
  22. tag:
  23. name: Create tag
  24. runs-on: ubuntu-20.04
  25. steps:
  26. - name: Get version info
  27. id: version_info
  28. run: |
  29. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  30. shell: bash
  31. - name: Create tag
  32. uses: actions/github-script@v6
  33. with:
  34. script: |
  35. github.rest.git.createRef({
  36. owner: context.repo.owner,
  37. repo: context.repo.repo,
  38. ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}',
  39. sha: context.sha
  40. })
  41. - name: Create release
  42. uses: ncipollo/release-action@v1
  43. with:
  44. name: ${{ steps.version_info.outputs.build_version }}
  45. tag: ${{ steps.version_info.outputs.build_version }}
  46. body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
  47. omitBodyDuringUpdate: true
  48. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  49. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  50. token: ${{ secrets.RELEASE_TOKEN }}
  51. release:
  52. name: Release for ${{ matrix.platform.name }}
  53. runs-on: ${{ matrix.platform.os }}
  54. timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT) }}
  55. strategy:
  56. matrix:
  57. platform:
  58. - { name: win-x64, os: windows-latest, zip_os_name: win_x64 }
  59. - { name: linux-x64, os: ubuntu-latest, zip_os_name: linux_x64 }
  60. - { name: linux-arm64, os: ubuntu-latest, zip_os_name: linux_arm64 }
  61. steps:
  62. - uses: actions/checkout@v4
  63. - uses: actions/setup-dotnet@v4
  64. with:
  65. global-json-file: global.json
  66. - name: Overwrite csc problem matcher
  67. run: echo "::add-matcher::.github/csc.json"
  68. - name: Get version info
  69. id: version_info
  70. run: |
  71. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  72. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  73. shell: bash
  74. - name: Configure for release
  75. run: |
  76. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  77. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  78. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  79. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  80. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  81. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  82. shell: bash
  83. - name: Create output dir
  84. run: "mkdir release_output"
  85. - name: Publish
  86. run: |
  87. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_ava/publish -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx --self-contained true
  88. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless/publish -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx.Headless.SDL2 --self-contained true
  89. - name: Packing Windows builds
  90. if: matrix.platform.os == 'windows-latest'
  91. run: |
  92. pushd publish_ava
  93. cp publish/Ryujinx.exe publish/Ryujinx.Ava.exe
  94. 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  95. 7z a ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  96. popd
  97. pushd publish_sdl2_headless
  98. 7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  99. popd
  100. shell: bash
  101. - name: Packing Linux builds
  102. if: matrix.platform.os == 'ubuntu-latest'
  103. run: |
  104. pushd publish_ava
  105. cp publish/Ryujinx publish/Ryujinx.Ava
  106. chmod +x publish/Ryujinx.sh publish/Ryujinx.Ava publish/Ryujinx
  107. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  108. tar -czvf ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  109. popd
  110. pushd publish_sdl2_headless
  111. chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2
  112. tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  113. popd
  114. shell: bash
  115. - name: Pushing new release
  116. uses: ncipollo/release-action@v1
  117. with:
  118. name: ${{ steps.version_info.outputs.build_version }}
  119. artifacts: "release_output/*.tar.gz,release_output/*.zip"
  120. tag: ${{ steps.version_info.outputs.build_version }}
  121. body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
  122. omitBodyDuringUpdate: true
  123. allowUpdates: true
  124. replacesArtifacts: true
  125. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  126. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  127. token: ${{ secrets.RELEASE_TOKEN }}
  128. macos_release:
  129. name: Release MacOS universal
  130. runs-on: ubuntu-latest
  131. timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT) }}
  132. steps:
  133. - uses: actions/checkout@v4
  134. - uses: actions/setup-dotnet@v4
  135. with:
  136. global-json-file: global.json
  137. - name: Setup LLVM 15
  138. run: |
  139. wget https://apt.llvm.org/llvm.sh
  140. chmod +x llvm.sh
  141. sudo ./llvm.sh 15
  142. - name: Install rcodesign
  143. run: |
  144. mkdir -p $HOME/.bin
  145. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  146. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  147. rm apple-codesign.tar.gz
  148. mv rcodesign $HOME/.bin/
  149. echo "$HOME/.bin" >> $GITHUB_PATH
  150. env:
  151. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  152. - name: Get version info
  153. id: version_info
  154. run: |
  155. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  156. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  157. - name: Configure for release
  158. run: |
  159. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  160. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  161. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  162. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  163. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  164. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  165. shell: bash
  166. - name: Publish macOS Ryujinx
  167. run: |
  168. ./distribution/macos/create_macos_build_ava.sh . publish_tmp_ava publish_ava ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release
  169. - name: Publish macOS Ryujinx.Headless.SDL2
  170. run: |
  171. ./distribution/macos/create_macos_build_headless.sh . publish_tmp_headless publish_headless ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release
  172. - name: Pushing new release
  173. uses: ncipollo/release-action@v1
  174. with:
  175. name: ${{ steps.version_info.outputs.build_version }}
  176. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  177. tag: ${{ steps.version_info.outputs.build_version }}
  178. body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
  179. omitBodyDuringUpdate: true
  180. allowUpdates: true
  181. replacesArtifacts: true
  182. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  183. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  184. token: ${{ secrets.RELEASE_TOKEN }}
  185. flatpak_release:
  186. uses: ./.github/workflows/flatpak.yml
  187. needs: release
  188. with:
  189. ryujinx_version: "1.1.${{ github.run_number }}"
  190. secrets: inherit