release.yml 12 KB

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