aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: f2bebc77fc69ff88d52b95cc9c69aa63da2350be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Release job

on:
  workflow_dispatch:
    inputs: {}
  push:
    branches: [ master ]
    paths-ignore:
      - '.github/**'
      - '*.yml'
      - '*.json'
      - '*.config'
      - '*.md'

concurrency: release

env:
  POWERSHELL_TELEMETRY_OPTOUT: 1
  DOTNET_CLI_TELEMETRY_OPTOUT: 1
  RYUJINX_BASE_VERSION: "1.1"
  RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "master"
  RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "Ryujinx"
  RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "release-channel-master"

jobs:
  tag:
    name: Create tag
    runs-on: ubuntu-20.04
    steps:
      - name: Get version info
        id: version_info
        run: |
          echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
        shell: bash

      - name: Create tag
        uses: actions/github-script@v6
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}',
              sha: context.sha
            })

      - name: Create release
        uses: ncipollo/release-action@v1
        with:
          name: ${{ steps.version_info.outputs.build_version }}
          tag: ${{ steps.version_info.outputs.build_version }}
          body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
          omitBodyDuringUpdate: true
          owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
          repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
          token: ${{ secrets.RELEASE_TOKEN }}

  release:
    name: Release for ${{ matrix.platform.name }}
    runs-on: ${{ matrix.platform.os }}
    timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT) }}
    strategy:
      matrix:
        platform:
          - { name: win-x64,     os: windows-latest, zip_os_name: win_x64     }
          - { name: linux-x64,   os: ubuntu-latest,  zip_os_name: linux_x64   }
          - { name: linux-arm64, os: ubuntu-latest,  zip_os_name: linux_arm64 }
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-dotnet@v4
        with:
          global-json-file: global.json

      - name: Overwrite csc problem matcher
        run: echo "::add-matcher::.github/csc.json"

      - name: Get version info
        id: version_info
        run: |
          echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
          echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
        shell: bash

      - name: Configure for release
        run: |
          sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
        shell: bash

      - name: Create output dir
        run: "mkdir release_output"

      - name: Publish
        run: |
          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
          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

      - name: Packing Windows builds
        if: matrix.platform.os == 'windows-latest'
        run: |
          pushd publish_ava
          cp publish/Ryujinx.exe publish/Ryujinx.Ava.exe
          7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
          7z a ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
          popd

          pushd publish_sdl2_headless
          7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish
          popd
        shell: bash

      - name: Packing Linux builds
        if: matrix.platform.os == 'ubuntu-latest'
        run: |
          pushd publish_ava
          cp publish/Ryujinx publish/Ryujinx.Ava
          chmod +x publish/Ryujinx.sh publish/Ryujinx.Ava publish/Ryujinx
          tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
          tar -czvf ../release_output/test-ava-ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
          popd

          pushd publish_sdl2_headless
          chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2
          tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
          popd
        shell: bash

      - name: Pushing new release
        uses: ncipollo/release-action@v1
        with:
          name: ${{ steps.version_info.outputs.build_version }}
          artifacts: "release_output/*.tar.gz,release_output/*.zip"
          tag: ${{ steps.version_info.outputs.build_version }}
          body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
          omitBodyDuringUpdate: true
          allowUpdates: true
          replacesArtifacts: true
          owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
          repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
          token: ${{ secrets.RELEASE_TOKEN }}

  macos_release:
    name: Release MacOS universal
    runs-on: ubuntu-latest
    timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT) }}
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-dotnet@v4
        with:
          global-json-file: global.json

      - name: Setup LLVM 15
        run: |
          wget https://apt.llvm.org/llvm.sh
          chmod +x llvm.sh
          sudo ./llvm.sh 15

      - name: Install rcodesign
        run: |
          mkdir -p $HOME/.bin
          gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
          tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
          rm apple-codesign.tar.gz
          mv rcodesign $HOME/.bin/
          echo "$HOME/.bin" >> $GITHUB_PATH
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Get version info
        id: version_info
        run: |
          echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
          echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT

      - name: Configure for release
        run: |
          sed -r --in-place 's/\%\%RYUJINX_BUILD_VERSION\%\%/${{ steps.version_info.outputs.build_version }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
          sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
        shell: bash

      - name: Publish macOS Ryujinx
        run: |
          ./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

      - name: Publish macOS Ryujinx.Headless.SDL2
        run: |
          ./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

      - name: Pushing new release
        uses: ncipollo/release-action@v1
        with:
          name: ${{ steps.version_info.outputs.build_version }}
          artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz"
          tag: ${{ steps.version_info.outputs.build_version }}
          body: "For more information about this release please check out the official [Changelog](https://github.com/Ryujinx/Ryujinx/wiki/Changelog)."
          omitBodyDuringUpdate: true
          allowUpdates: true
          replacesArtifacts: true
          owner: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}
          repo: ${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}
          token: ${{ secrets.RELEASE_TOKEN }}

  flatpak_release:
    uses: ./.github/workflows/flatpak.yml
    needs: release
    with:
      ryujinx_version: "1.1.${{ github.run_number }}"
    secrets: inherit