release.yml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. name: Release job
  2. on:
  3. workflow_dispatch:
  4. inputs: {}
  5. push:
  6. branches: [ master ]
  7. paths-ignore:
  8. - '.github/**'
  9. - 'docs/**'
  10. - '*.yml'
  11. - '*.json'
  12. - '*.config'
  13. - '*.md'
  14. concurrency: release
  15. env:
  16. POWERSHELL_TELEMETRY_OPTOUT: 1
  17. DOTNET_CLI_TELEMETRY_OPTOUT: 1
  18. RYUJINX_BASE_VERSION: "1.2"
  19. RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "master"
  20. RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "GreemDev"
  21. RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx"
  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=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $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. omitBodyDuringUpdate: true
  48. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  49. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  50. token: ${{ secrets.RELEASE_TOKEN }}
  51. release:
  52. name: Release for ${{ matrix.platform.name }}
  53. runs-on: ${{ matrix.platform.os }}
  54. strategy:
  55. matrix:
  56. platform:
  57. - { name: win-x64, os: windows-latest, zip_os_name: win_x64 }
  58. - { name: linux-x64, os: ubuntu-latest, zip_os_name: linux_x64 }
  59. - { name: linux-arm64, os: ubuntu-latest, zip_os_name: linux_arm64 }
  60. steps:
  61. - uses: actions/checkout@v4
  62. - uses: actions/setup-dotnet@v4
  63. with:
  64. global-json-file: global.json
  65. - name: Overwrite csc problem matcher
  66. run: echo "::add-matcher::.github/csc.json"
  67. - name: Get version info
  68. id: version_info
  69. run: |
  70. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  71. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  72. shell: bash
  73. - name: Configure for release
  74. run: |
  75. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  76. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  77. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  78. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  79. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  80. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  81. shell: bash
  82. - name: Create output dir
  83. run: "mkdir release_output"
  84. - name: Publish
  85. run: |
  86. 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 true
  87. 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 true
  88. - name: Packing Windows builds
  89. if: matrix.platform.os == 'windows-latest'
  90. run: |
  91. pushd publish_ava
  92. 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  93. popd
  94. pushd publish_sdl2_headless
  95. 7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
  96. popd
  97. shell: bash
  98. - name: Packing Linux builds
  99. if: matrix.platform.os == 'ubuntu-latest'
  100. run: |
  101. pushd publish_ava
  102. chmod +x publish/Ryujinx.sh publish/Ryujinx
  103. tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  104. popd
  105. pushd publish_sdl2_headless
  106. chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2
  107. tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
  108. popd
  109. shell: bash
  110. - name: Pushing new release
  111. uses: ncipollo/release-action@v1
  112. with:
  113. name: ${{ steps.version_info.outputs.build_version }}
  114. artifacts: "release_output/*.tar.gz,release_output/*.zip"
  115. tag: ${{ steps.version_info.outputs.build_version }}
  116. omitBodyDuringUpdate: true
  117. allowUpdates: true
  118. replacesArtifacts: true
  119. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  120. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  121. token: ${{ secrets.RELEASE_TOKEN }}
  122. macos_release:
  123. name: Release MacOS universal
  124. runs-on: ubuntu-latest
  125. steps:
  126. - uses: actions/checkout@v4
  127. - uses: actions/setup-dotnet@v4
  128. with:
  129. global-json-file: global.json
  130. - name: Setup LLVM 15
  131. run: |
  132. wget https://apt.llvm.org/llvm.sh
  133. chmod +x llvm.sh
  134. sudo ./llvm.sh 15
  135. - name: Install rcodesign
  136. run: |
  137. mkdir -p $HOME/.bin
  138. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  139. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  140. rm apple-codesign.tar.gz
  141. mv rcodesign $HOME/.bin/
  142. echo "$HOME/.bin" >> $GITHUB_PATH
  143. env:
  144. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  145. - name: Get version info
  146. id: version_info
  147. run: |
  148. echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
  149. echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  150. - name: Configure for release
  151. run: |
  152. sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  153. sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  154. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  155. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  156. sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
  157. sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  158. shell: bash
  159. - name: Publish macOS Ryujinx
  160. run: |
  161. ./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
  162. - name: Publish macOS Ryujinx.Headless.SDL2
  163. run: |
  164. ./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
  165. - name: Pushing new release
  166. uses: ncipollo/release-action@v1
  167. with:
  168. name: ${{ steps.version_info.outputs.build_version }}
  169. artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
  170. tag: ${{ steps.version_info.outputs.build_version }}
  171. omitBodyDuringUpdate: true
  172. allowUpdates: true
  173. replacesArtifacts: true
  174. owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
  175. repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
  176. token: ${{ secrets.RELEASE_TOKEN }}