release.yml 13 KB

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