release.yml 9.0 KB

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