release.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
  95. ZIP_OS_NAME="${{ matrix.platform.zip_os_name }}"
  96. pushd publish_ava
  97. cp Ryujinx.exe Ryujinx.Ava.exe
  98. 7z a ../release_output/ryujinx-$BUILD_VERSION-$ZIP_OS_NAME.zip *
  99. popd
  100. pushd publish_sdl2_headless
  101. 7z a ../release_output/sdl2-ryujinx-headless-$BUILD_VERSION-$ZIP_OS_NAME.zip *
  102. popd
  103. shell: bash
  104. - name: Build AppImage (Linux)
  105. if: matrix.platform.os == 'ubuntu-latest'
  106. run: |
  107. BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
  108. PLATFORM_NAME="${{ matrix.platform.name }}"
  109. sudo apt install -y zsync desktop-file-utils appstream
  110. mkdir -p tools
  111. export PATH="$PATH:$(readlink -f tools)"
  112. # Setup appimagetool
  113. wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
  114. chmod +x tools/appimagetool
  115. # Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
  116. if [ "$PLATFORM_NAME" = "linux-x64" ]; then
  117. ARCH_NAME=x64
  118. export ARCH=x86_64
  119. elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
  120. ARCH_NAME=arm64
  121. export ARCH=aarch64
  122. else
  123. echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
  124. exit 1
  125. fi
  126. export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
  127. BUILDDIR=publish_ava OUTDIR=publish_ava_appimage distribution/linux/appimage/build-appimage.sh
  128. # Add to release output
  129. pushd publish_ava_appimage
  130. mv Ryujinx.AppImage ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage
  131. mv Ryujinx.AppImage.zsync ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage.zsync
  132. popd
  133. shell: bash
  134. - name: Packing Linux builds
  135. if: matrix.platform.os == 'ubuntu-latest'
  136. run: |
  137. BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
  138. ZIP_OS_NAME="${{ matrix.platform.zip_os_name }}"
  139. pushd publish_ava
  140. cp Ryujinx Ryujinx.Ava
  141. chmod +x Ryujinx.sh Ryujinx Ryujinx.Ava
  142. tar -czvf ../release_output/ryujinx-$BUILD_VERSION-$ZIP_OS_NAME.tar.gz *
  143. popd
  144. pushd publish_sdl2_headless
  145. chmod +x Ryujinx.sh Ryujinx.Headless.SDL2
  146. tar -czvf ../release_output/sdl2-ryujinx-headless-$BUILD_VERSION-$ZIP_OS_NAME.tar.gz *
  147. popd
  148. shell: bash
  149. - name: Pushing new release
  150. uses: ncipollo/release-action@v1
  151. with:
  152. name: ${{ steps.version_info.outputs.build_version }}
  153. tag: ${{ steps.version_info.outputs.build_version }}
  154. artifacts: "release_output/*.tar.gz,release_output/*.zip,release_output/*AppImage*"
  155. draft: "true"
  156. omitBody: true
  157. #omitBodyDuringUpdate: true
  158. allowUpdates: true
  159. replacesArtifacts: true
  160. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  161. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  162. token: ${{ secrets.GITHUB_TOKEN }}
  163. macos_release:
  164. name: Release MacOS universal
  165. runs-on: ubuntu-latest
  166. timeout-minutes: 60
  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=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  191. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  192. shell: bash
  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_OWNER\%\%&${{ github.repository_owner }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  198. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%&${{ github.event.repository.name }}&g;' src/Ryujinx.Common/ReleaseInformation.cs
  199. sed -r --in-place 's&\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%&${{ github.ref_name }}&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. tag: ${{ steps.version_info.outputs.build_version }}
  213. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  214. draft: "true"
  215. omitBody: true
  216. #omitBodyDuringUpdate: true
  217. allowUpdates: true
  218. replacesArtifacts: true
  219. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  220. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  221. token: ${{ secrets.GITHUB_TOKEN }}
  222. set_latest_release:
  223. name: Set as latest release
  224. runs-on: ubuntu-latest
  225. needs: [release, macos_release]
  226. steps:
  227. - name: Get version info
  228. id: version_info
  229. run: |
  230. echo "build_version=r.`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_OUTPUT
  231. shell: bash
  232. - name: Update release
  233. uses: ncipollo/release-action@v1
  234. with:
  235. name: ${{ steps.version_info.outputs.build_version }}
  236. tag: ${{ steps.version_info.outputs.build_version }}
  237. makeLatest: "true"
  238. omitBody: true
  239. allowUpdates: true
  240. #owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  241. #repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  242. token: ${{ secrets.GITHUB_TOKEN }}