release.yml 12 KB

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