release.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. name: Release job
  2. on:
  3. workflow_dispatch:
  4. inputs: {}
  5. push:
  6. branches: [ release ]
  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: "release"
  21. RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "GreemDev"
  22. RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx"
  23. RELEASE: 1
  24. jobs:
  25. tag:
  26. name: Create tag
  27. runs-on: ubuntu-20.04
  28. steps:
  29. - name: Get version info
  30. id: version_info
  31. run: |
  32. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  33. echo "prev_build_version=${{ env.RYUJINX_BASE_VERSION }}.$((${{ github.run_number }} - 1))" >> $GITHUB_OUTPUT
  34. shell: bash
  35. - name: Create tag
  36. uses: actions/github-script@v7
  37. with:
  38. script: |
  39. github.rest.git.createRef({
  40. owner: context.repo.owner,
  41. repo: context.repo.repo,
  42. ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}',
  43. sha: context.sha
  44. })
  45. - name: Create release
  46. uses: ncipollo/release-action@v1
  47. with:
  48. name: ${{ steps.version_info.outputs.build_version }}
  49. tag: ${{ steps.version_info.outputs.build_version }}
  50. body: |
  51. # Regular builds:
  52. | Platform | Artifact |
  53. |--|--|
  54. | Windows 64 bit | [Release Windows Artifact](https://github.com/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_x64.zip) |
  55. | Linux 64 bit | [Release Linux Artifact](https://github.com/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_x64.tar.gz) |
  56. | Linux arm 64 bit | [Release Linux arm Artifact](https://github.com/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_arm64.tar.gz) |
  57. | macOS | [Release macOS Artifact](https://github.com/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz) |
  58. **Full Changelog**: https://github.com/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}
  59. omitBodyDuringUpdate: true
  60. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  61. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  62. token: ${{ secrets.RELEASE_TOKEN }}
  63. release:
  64. name: Release for ${{ matrix.platform.name }}
  65. runs-on: ${{ matrix.platform.os }}
  66. strategy:
  67. matrix:
  68. platform:
  69. - { name: win-x64, os: windows-latest, zip_os_name: win_x64 }
  70. - { name: linux-x64, os: ubuntu-latest, zip_os_name: linux_x64 }
  71. - { name: linux-arm64, os: ubuntu-latest, zip_os_name: linux_arm64 }
  72. steps:
  73. - uses: actions/checkout@v4
  74. - uses: actions/setup-dotnet@v4
  75. with:
  76. global-json-file: global.json
  77. - name: Overwrite csc problem matcher
  78. run: echo "::add-matcher::.github/csc.json"
  79. - name: Get version info
  80. id: version_info
  81. run: |
  82. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  83. echo "prev_build_version=${{ env.RYUJINX_BASE_VERSION }}.$((${{ github.run_number }} - 1))" >> $GITHUB_OUTPUT
  84. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  85. shell: bash
  86. - name: Configure for release
  87. run: |
  88. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  89. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  90. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  91. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  92. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  93. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  94. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  95. shell: bash
  96. - name: Create output dir
  97. run: "mkdir release_output"
  98. - name: Publish
  99. run: |
  100. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./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
  101. dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless -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
  102. - name: Packing Windows builds
  103. if: matrix.platform.os == 'windows-latest'
  104. run: |
  105. pushd publish
  106. rm libarmeilleure-jitsupport.dylib
  107. 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip ../publish
  108. popd
  109. pushd publish_sdl2_headless
  110. rm libarmeilleure-jitsupport.dylib
  111. 7z a ../release_output/nogui-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip ../publish
  112. popd
  113. shell: bash
  114. - name: Build AppImage (Linux)
  115. if: matrix.platform.os == 'ubuntu-latest'
  116. run: |
  117. BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
  118. PLATFORM_NAME="${{ matrix.platform.name }}"
  119. sudo apt install -y zsync desktop-file-utils appstream
  120. mkdir -p tools
  121. export PATH="$PATH:$(readlink -f tools)"
  122. # Setup appimagetool
  123. wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
  124. chmod +x tools/appimagetool
  125. chmod +x distribution/linux/appimage/build-appimage.sh
  126. # Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
  127. if [ "$PLATFORM_NAME" = "linux-x64" ]; then
  128. ARCH_NAME=x64
  129. export ARCH=x86_64
  130. elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
  131. ARCH_NAME=arm64
  132. export ARCH=aarch64
  133. else
  134. echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
  135. exit 1
  136. fi
  137. export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
  138. BUILDDIR=publish OUTDIR=publish_appimage distribution/linux/appimage/build-appimage.sh
  139. pushd publish_appimage
  140. mv Ryujinx.AppImage ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage
  141. mv Ryujinx.AppImage.zsync ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage.zsync
  142. popd
  143. shell: bash
  144. - name: Packing Linux builds
  145. if: matrix.platform.os == 'ubuntu-latest'
  146. run: |
  147. pushd publish
  148. chmod +x Ryujinx.sh Ryujinx
  149. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz ../publish
  150. popd
  151. pushd publish_sdl2_headless
  152. chmod +x Ryujinx.sh Ryujinx.Headless.SDL2
  153. tar -czvf ../release_output/nogui-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz ../publish
  154. popd
  155. shell: bash
  156. - name: Pushing new release
  157. uses: ncipollo/release-action@v1
  158. with:
  159. name: ${{ steps.version_info.outputs.build_version }}
  160. artifacts: "release_output/*.tar.gz,release_output/*.zip,release_output/*AppImage*"
  161. tag: ${{ steps.version_info.outputs.build_version }}
  162. body: |
  163. # Regular builds:
  164. | Platform | Artifact |
  165. |--|--|
  166. | Windows 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_x64.zip |
  167. | Linux 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_x64.tar.gz |
  168. | Linux arm 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_arm64.tar.gz |
  169. | Macos | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz |
  170. "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}"
  171. omitBodyDuringUpdate: true
  172. allowUpdates: true
  173. replacesArtifacts: true
  174. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  175. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  176. token: ${{ secrets.RELEASE_TOKEN }}
  177. macos_release:
  178. name: Release MacOS universal
  179. runs-on: ubuntu-latest
  180. steps:
  181. - uses: actions/checkout@v4
  182. - uses: actions/setup-dotnet@v4
  183. with:
  184. global-json-file: global.json
  185. - name: Setup LLVM 15
  186. run: |
  187. wget https://apt.llvm.org/llvm.sh
  188. chmod +x llvm.sh
  189. sudo ./llvm.sh 15
  190. - name: Install rcodesign
  191. run: |
  192. mkdir -p $HOME/.bin
  193. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  194. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  195. rm apple-codesign.tar.gz
  196. mv rcodesign $HOME/.bin/
  197. echo "$HOME/.bin" >> $GITHUB_PATH
  198. env:
  199. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  200. - name: Get version info
  201. id: version_info
  202. run: |
  203. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  204. echo "prev_build_version=${{ env.RYUJINX_BASE_VERSION }}.$((${{ github.run_number }} - 1))" >> $GITHUB_OUTPUT
  205. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  206. - name: Configure for release
  207. run: |
  208. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  209. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  210. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  211. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  212. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  213. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  214. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  215. shell: bash
  216. - name: Publish macOS Ryujinx
  217. run: |
  218. ./distribution/macos/create_macos_build_ava.sh . publish_tmp_ava publish ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release 0
  219. - name: Publish macOS Ryujinx.Headless.SDL2
  220. run: |
  221. ./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 0
  222. - name: Pushing new release
  223. uses: ncipollo/release-action@v1
  224. with:
  225. name: ${{ steps.version_info.outputs.build_version }}
  226. artifacts: "publish/*.tar.gz, publish_headless/*.tar.gz"
  227. tag: ${{ steps.version_info.outputs.build_version }}
  228. body: |
  229. # Regular builds:
  230. | Platform | Artifact |
  231. |--|--|
  232. | Windows 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_x64.zip |
  233. | Linux 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_x64.tar.gz |
  234. | Linux arm 64 bit | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_arm64.tar.gz |
  235. | Macos | https://github.com/${{ github.repository }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz |
  236. "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}"
  237. omitBodyDuringUpdate: true
  238. allowUpdates: true
  239. replacesArtifacts: true
  240. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  241. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  242. token: ${{ secrets.RELEASE_TOKEN }}