release.yml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.2"
  18. RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "master"
  19. RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "GreemDev"
  20. RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx"
  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. omitBodyDuringUpdate: true
  47. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  48. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  49. token: ${{ secrets.RELEASE_TOKEN }}
  50. release:
  51. name: Release for ${{ matrix.platform.name }}
  52. runs-on: ${{ matrix.platform.os }}
  53. strategy:
  54. matrix:
  55. platform:
  56. - { name: win-x64, os: windows-latest, zip_os_name: win_x64 }
  57. - { name: linux-x64, os: ubuntu-latest, zip_os_name: linux_x64 }
  58. - { name: linux-arm64, os: ubuntu-latest, zip_os_name: linux_arm64 }
  59. steps:
  60. - uses: actions/checkout@v4
  61. - uses: actions/setup-dotnet@v4
  62. with:
  63. global-json-file: global.json
  64. - name: Overwrite csc problem matcher
  65. run: echo "::add-matcher::.github/csc.json"
  66. - name: Get version info
  67. id: version_info
  68. run: |
  69. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  70. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  71. shell: bash
  72. - name: Configure for release
  73. run: |
  74. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  75. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  76. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  77. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  78. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  79. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  80. shell: bash
  81. - name: Create output dir
  82. run: "mkdir release_output"
  83. - name: Publish
  84. run: |
  85. 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
  86. 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
  87. - name: Packing Windows builds
  88. if: matrix.platform.os == 'windows-latest'
  89. run: |
  90. pushd publish_ava
  91. cp publish/Ryujinx.exe publish/Ryujinx.Ava.exe
  92. 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  93. 7z a ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  94. popd
  95. pushd publish_sdl2_headless
  96. 7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  97. popd
  98. shell: bash
  99. - name: Packing Linux builds
  100. if: matrix.platform.os == 'ubuntu-latest'
  101. run: |
  102. pushd publish_ava
  103. cp publish/Ryujinx publish/Ryujinx.Ava
  104. chmod +x publish/Ryujinx.sh publish/Ryujinx.Ava publish/Ryujinx
  105. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  106. tar -czvf ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  107. popd
  108. pushd publish_sdl2_headless
  109. chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2
  110. tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  111. popd
  112. shell: bash
  113. - name: Pushing new release
  114. uses: ncipollo/release-action@v1
  115. with:
  116. name: ${{ steps.version_info.outputs.build_version }}
  117. artifacts: "release_output/*.tar.gz,release_output/*.zip"
  118. tag: ${{ steps.version_info.outputs.build_version }}
  119. omitBodyDuringUpdate: true
  120. allowUpdates: true
  121. replacesArtifacts: true
  122. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  123. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  124. token: ${{ secrets.RELEASE_TOKEN }}
  125. macos_release:
  126. name: Release MacOS universal
  127. runs-on: ubuntu-latest
  128. steps:
  129. - uses: actions/checkout@v4
  130. - uses: actions/setup-dotnet@v4
  131. with:
  132. global-json-file: global.json
  133. - name: Setup LLVM 15
  134. run: |
  135. wget https://apt.llvm.org/llvm.sh
  136. chmod +x llvm.sh
  137. sudo ./llvm.sh 15
  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. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  161. shell: bash
  162. - name: Publish macOS Ryujinx
  163. run: |
  164. ./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
  165. - name: Publish macOS Ryujinx.Headless.SDL2
  166. run: |
  167. ./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
  168. - name: Pushing new release
  169. uses: ncipollo/release-action@v1
  170. with:
  171. name: ${{ steps.version_info.outputs.build_version }}
  172. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  173. tag: ${{ steps.version_info.outputs.build_version }}
  174. omitBodyDuringUpdate: true
  175. allowUpdates: true
  176. replacesArtifacts: true
  177. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  178. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  179. token: ${{ secrets.RELEASE_TOKEN }}