release.yml 9.0 KB

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