release.yml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. shell: bash
  33. - name: Create tag
  34. uses: actions/github-script@v6
  35. with:
  36. script: |
  37. github.rest.git.createRef({
  38. owner: context.repo.owner,
  39. repo: context.repo.repo,
  40. ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}',
  41. sha: context.sha
  42. })
  43. - name: Create release
  44. uses: ncipollo/release-action@v1
  45. with:
  46. name: ${{ steps.version_info.outputs.build_version }}
  47. tag: ${{ steps.version_info.outputs.build_version }}
  48. omitBodyDuringUpdate: true
  49. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  50. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  51. token: ${{ secrets.RELEASE_TOKEN }}
  52. release:
  53. name: Release for ${{ matrix.platform.name }}
  54. runs-on: ${{ matrix.platform.os }}
  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. 7z a ../release_output/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. chmod +x publish/Ryujinx.sh publish/Ryujinx
  104. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  105. popd
  106. pushd publish_sdl2_headless
  107. chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2
  108. tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.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. 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@v4
  128. - uses: actions/setup-dotnet@v4
  129. with:
  130. global-json-file: global.json
  131. - name: Setup LLVM 15
  132. run: |
  133. wget https://apt.llvm.org/llvm.sh
  134. chmod +x llvm.sh
  135. sudo ./llvm.sh 15
  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. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  159. shell: bash
  160. - name: Publish macOS Ryujinx
  161. run: |
  162. ./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
  163. - name: Publish macOS Ryujinx.Headless.SDL2
  164. run: |
  165. ./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
  166. - name: Pushing new release
  167. uses: ncipollo/release-action@v1
  168. with:
  169. name: ${{ steps.version_info.outputs.build_version }}
  170. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  171. tag: ${{ steps.version_info.outputs.build_version }}
  172. omitBodyDuringUpdate: true
  173. allowUpdates: true
  174. replacesArtifacts: true
  175. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  176. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  177. token: ${{ secrets.RELEASE_TOKEN }}