forked from stakira/OpenUtau
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (139 loc) · 5.78 KB
/
build.yml
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
on:
workflow_dispatch:
inputs:
version:
description: "Version"
default: "0.0.0"
required: true
type: string
release:
type: boolean
default: false
description: "Release"
beta:
type: boolean
default: true
description: "Beta"
draft:
type: boolean
default: true
description: "Draft"
env:
release-name: ${{ inputs.version }}${{ inputs.beta && ' Beta' || '' }}
jobs:
build:
runs-on: ${{ matrix.arch.runs-on }}
strategy:
fail-fast: false
matrix:
arch:
- { name: win-x64, rid: win-x64, arch: x64, os: win, runs-on: windows-latest }
- { name: win-x86, rid: win-x86, arch: x86, os: win, runs-on: windows-latest }
- { name: win-arm64, rid: win-arm64, arch: arm64, os: win, runs-on: windows-latest }
- { name: osx-x64, rid: osx.10.14-x64, arch: x64, os: osx, runs-on: macos-13 }
- { name: osx-arm64, rid: osx-arm64, arch: arm64, os: osx, runs-on: macos-13 }
- { name: linux-x64, rid: linux-x64, arch: x64, os: linux, runs-on: ubuntu-latest }
- { name: linux-arm64, rid: linux-arm64, arch: arm64, os: linux, runs-on: ubuntu-latest }
steps:
# Setup
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: justalemon/[email protected]
with:
version: ${{ inputs.version }}
csproj-files: "OpenUtau/*.csproj"
# Test
- name: Test
run: dotnet test OpenUtau.Test
# Build
- name: Restore
run: dotnet restore OpenUtau -r ${{ matrix.arch.rid }}
- name: Publish
run: dotnet publish OpenUtau -c Release -r ${{ matrix.arch.rid }} --self-contained true -o bin/${{ matrix.arch.name }}/
if: ${{ matrix.arch.os != 'osx' }}
# Create Zip
- name: DirectML
shell: cmd
run: |
curl -L https://www.nuget.org/api/v2/package/Microsoft.AI.DirectML/1.12.0 -o Microsoft.AI.DirectML.nupkg
mkdir Microsoft.AI.DirectML
tar -xf Microsoft.AI.DirectML.nupkg -C Microsoft.AI.DirectML
copy /y Microsoft.AI.DirectML\bin\${{ matrix.arch.arch }}-${{ matrix.arch.os }}\DirectML.dll bin\${{ matrix.arch.name }}\
if: ${{ matrix.arch.os == 'win' }}
- name: Set executable permission
run: chmod +x bin/${{ matrix.arch.name }}/OpenUtau
if: ${{ matrix.arch.os == 'linux' }}
- name: Zip
run: |
cd bin/${{ matrix.arch.name }}
7z a ../../OpenUtau-${{ matrix.arch.name }}.zip *
if: ${{ matrix.arch.os != 'osx' }}
# Create Installer
- name: Get VC Redist
run: |
curl https://aka.ms/vs/17/release/vc_redist.${{ matrix.arch.arch }}.exe -o vc_redist.${{ matrix.arch.arch }}.exe
if: ${{ matrix.arch.os == 'win' }}
- name: Create Installer
uses: joncloud/[email protected]
with:
script-file: OpenUtau.nsi
arguments: "-DPRODUCT_VERSION=${{ inputs.version }} -DARCH=${{ matrix.arch.arch }}"
if: ${{ matrix.arch.os == 'win' }}
# Create Dmg
- name: Create Dmg
run: |
dotnet msbuild OpenUtau -t:BundleApp -p:Configuration=Release -p:RuntimeIdentifier=${{ matrix.arch.rid }} -p:UseAppHost=true -p:OutputPath=../bin/${{ matrix.arch.name }}/
npm install -g create-dmg
cp OpenUtau/Assets/OpenUtau.icns bin/${{ matrix.arch.name }}/publish/OpenUtau.app/Contents/Resources/
create-dmg bin/${{ matrix.arch.name }}/publish/OpenUtau.app || true
mv *.dmg OpenUtau-${{ matrix.arch.name }}.dmg
codesign -fvs - OpenUtau-${{ matrix.arch.name }}.dmg
if: ${{ matrix.arch.os == 'osx' }}
# Upload Artifacts
- uses: actions/upload-artifact@v4
with:
name: OpenUtau-${{ matrix.arch.name }}.zip
path: OpenUtau-${{ matrix.arch.name }}.zip
if: ${{ !inputs.release && matrix.arch.os != 'osx' }}
- uses: actions/upload-artifact@v4
with:
name: OpenUtau-${{ matrix.arch.name }}.exe
path: OpenUtau-${{ matrix.arch.name }}.exe
if: ${{ !inputs.release && matrix.arch.os == 'win' }}
- uses: actions/upload-artifact@v4
with:
name: OpenUtau-osx-${{ matrix.arch.name }}.dmg
path: OpenUtau-osx-${{ matrix.arch.name }}.dmg
if: ${{ !inputs.release && matrix.arch.os == 'osx' }}
# Appcast
- name: Appcast Windows
shell: cmd
run: |
python appcast.py -v=${{ inputs.version }} -o=windows -r=${{ matrix.arch.name }} -f=OpenUtau-${{ matrix.arch.name }}.zip
python appcast.py -v=${{ inputs.version }} -o=windows -r=${{ matrix.arch.name }}-installer -f=OpenUtau-${{ matrix.arch.name }}.exe
if: ${{ inputs.release && matrix.arch.os == 'win' }}
- name: Appcast MacOS
run: |
python appcast.py -v=${{ inputs.version }} -o=macos -r=${{ matrix.arch.name }} -f=OpenUtau-${{ matrix.arch.name }}.dmg
if: ${{ inputs.release && matrix.arch.os == 'osx' }}
- name: Appcast Linux
run: |
python appcast.py -v=${{ inputs.version }} -o=linux -r=${{ matrix.arch.name }} -f=OpenUtau-${{ matrix.arch.name }}.zip
if: ${{ inputs.release && matrix.arch.os == 'linux' }}
# Release
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
name: ${{ env.release-name }}
prerelease: ${{ inputs.beta }}
draft: ${{ inputs.draft }}
files: |
appcast.${{ matrix.arch.name }}*.xml
OpenUtau-${{ matrix.arch.name }}.*
if: ${{ inputs.release }}