release.yml 12 KB

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