release.yml 9.9 KB

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