release.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. name: Release job
  2. on:
  3. workflow_dispatch:
  4. inputs: {}
  5. #push:
  6. # branches: [ mirror/release ]
  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.1" # NOTE: For now, releases for the fork will be named after Git revision hashes, this is ignored
  18. # Should be unnecessary for us, we're releasing in-repo
  19. #RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "ryujinx-mirror"
  20. #RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "ryujinx"
  21. #RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "mirror/master"
  22. jobs:
  23. tag:
  24. name: Create tag
  25. runs-on: ubuntu-20.04
  26. steps:
  27. - name: Get version info
  28. id: version_info
  29. run: |
  30. echo "build_version=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  31. shell: bash
  32. - name: Create tag
  33. uses: actions/github-script@v6
  34. with:
  35. script: |
  36. github.rest.git.createRef({
  37. owner: context.repo.owner,
  38. repo: context.repo.repo,
  39. ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}',
  40. sha: context.sha
  41. })
  42. - name: Create release
  43. uses: ncipollo/release-action@v1
  44. with:
  45. name: ${{ steps.version_info.outputs.build_version }}
  46. tag: ${{ steps.version_info.outputs.build_version }}
  47. draft: "true"
  48. omitBody: true
  49. #omitBodyDuringUpdate: true
  50. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  51. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  52. token: ${{ secrets.GITHUB_TOKEN }}
  53. release:
  54. name: Release for ${{ matrix.platform.name }}
  55. runs-on: ${{ matrix.platform.os }}
  56. timeout-minutes: 60
  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=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  74. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  75. shell: bash
  76. - name: Configure for release
  77. run: |
  78. sed -r --in-place 's&\%\%RYUJINX_BUILD_VERSION\%\%&${{ steps.version_info.outputs.build_version }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  79. sed -r --in-place 's&\%\%RYUJINX_BUILD_GIT_HASH\%\%&${{ steps.version_info.outputs.git_short_hash }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  80. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%&${{ github.repository_owner }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  81. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%&${{ github.event.repository.name }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  82. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%&${{ github.ref_name }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  83. sed -r --in-place 's&\%\%RYUJINX_CONFIG_FILE_NAME\%\%&Config\.json&g;' src/Ryujinx.Common/ReleaseInformation.cs
  84. shell: bash
  85. - name: Create output dir
  86. run: "mkdir release_output"
  87. - name: Publish
  88. run: |
  89. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_ava -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx --self-contained true
  90. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx.Headless.SDL2 --self-contained true
  91. - name: Packing Windows builds
  92. if: matrix.platform.os == 'windows-latest'
  93. run: |
  94. pushd publish_ava
  95. cp Ryujinx.exe Ryujinx.Ava.exe
  96. 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip *
  97. 7z a ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip *
  98. popd
  99. pushd publish_sdl2_headless
  100. 7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip *
  101. popd
  102. shell: bash
  103. - name: Build AppImage (Linux)
  104. if: matrix.platform.os == 'ubuntu-latest'
  105. run: |
  106. PLATFORM_NAME="${{ matrix.platform.name }}"
  107. sudo apt install -y zsync desktop-file-utils appstream
  108. mkdir -p tools
  109. export PATH="$PATH:$(readlink -f tools)"
  110. # Setup appimagetool
  111. wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
  112. chmod +x tools/appimagetool
  113. if [ "$PLATFORM_NAME" = "linux-x64" ]; then
  114. export ARCH=x86_64
  115. elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
  116. export ARCH=aarch64
  117. else
  118. echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
  119. exit 1
  120. fi
  121. BUILDDIR=publish_ava OUTDIR=publish_ava_appimage distribution/linux/appimage/build-appimage.sh
  122. shell: bash
  123. - name: Packing Linux builds
  124. if: matrix.platform.os == 'ubuntu-latest'
  125. run: |
  126. pushd publish_ava
  127. cp Ryujinx Ryujinx.Ava
  128. chmod +x Ryujinx.sh Ryujinx Ryujinx.Ava
  129. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz *
  130. tar -czvf ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz *
  131. popd
  132. pushd publish_sdl2_headless
  133. chmod +x Ryujinx.sh Ryujinx.Headless.SDL2
  134. tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz *
  135. popd
  136. # AppImage archive
  137. pushd publish_ava_appimage
  138. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}-AppImage.tar.gz *
  139. popd
  140. shell: bash
  141. - name: Pushing new release
  142. uses: ncipollo/release-action@v1
  143. with:
  144. name: ${{ steps.version_info.outputs.build_version }}
  145. tag: ${{ steps.version_info.outputs.build_version }}
  146. artifacts: "release_output/*.tar.gz,release_output/*.zip"
  147. draft: "true"
  148. omitBody: true
  149. #omitBodyDuringUpdate: true
  150. allowUpdates: true
  151. replacesArtifacts: true
  152. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  153. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  154. token: ${{ secrets.GITHUB_TOKEN }}
  155. macos_release:
  156. name: Release MacOS universal
  157. runs-on: ubuntu-latest
  158. timeout-minutes: 60
  159. steps:
  160. - uses: actions/checkout@v4
  161. - uses: actions/setup-dotnet@v4
  162. with:
  163. global-json-file: global.json
  164. - name: Setup LLVM 15
  165. run: |
  166. wget https://apt.llvm.org/llvm.sh
  167. chmod +x llvm.sh
  168. sudo ./llvm.sh 15
  169. - name: Install rcodesign
  170. run: |
  171. mkdir -p $HOME/.bin
  172. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  173. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  174. rm apple-codesign.tar.gz
  175. mv rcodesign $HOME/.bin/
  176. echo "$HOME/.bin" >> $GITHUB_PATH
  177. env:
  178. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  179. - name: Get version info
  180. id: version_info
  181. run: |
  182. echo "build_version=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  183. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  184. shell: bash
  185. - name: Configure for release
  186. run: |
  187. sed -r --in-place 's&\%\%RYUJINX_BUILD_VERSION\%\%&${{ steps.version_info.outputs.build_version }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  188. sed -r --in-place 's&\%\%RYUJINX_BUILD_GIT_HASH\%\%&${{ steps.version_info.outputs.git_short_hash }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  189. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%&${{ github.repository_owner }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  190. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%&${{ github.event.repository.name }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  191. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%&${{ github.ref_name }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  192. sed -r --in-place 's&\%\%RYUJINX_CONFIG_FILE_NAME\%\%&Config\.json&g;' src/Ryujinx.Common/ReleaseInformation.cs
  193. shell: bash
  194. - name: Publish macOS Ryujinx
  195. run: |
  196. ./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
  197. - name: Publish macOS Ryujinx.Headless.SDL2
  198. run: |
  199. ./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
  200. - name: Pushing new release
  201. uses: ncipollo/release-action@v1
  202. with:
  203. name: ${{ steps.version_info.outputs.build_version }}
  204. tag: ${{ steps.version_info.outputs.build_version }}
  205. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  206. draft: "true"
  207. omitBody: true
  208. #omitBodyDuringUpdate: true
  209. allowUpdates: true
  210. replacesArtifacts: true
  211. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  212. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  213. token: ${{ secrets.GITHUB_TOKEN }}
  214. set_latest_release:
  215. name: Set as latest release
  216. runs-on: ubuntu-latest
  217. needs: [release, macos_release]
  218. steps:
  219. - name: Get version info
  220. id: version_info
  221. run: |
  222. echo "build_version=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  223. shell: bash
  224. - name: Update release
  225. uses: ncipollo/release-action@v1
  226. with:
  227. name: ${{ steps.version_info.outputs.build_version }}
  228. tag: ${{ steps.version_info.outputs.build_version }}
  229. makeLatest: "true"
  230. omitBody: true
  231. allowUpdates: true
  232. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  233. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  234. token: ${{ secrets.GITHUB_TOKEN }}