Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 55 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ on:
default: "0.0.0"
required: true
type: string
channel:
description: 'Channel'
type: choice
required: true
default: 'beta'
options:
- 'stable'
- 'beta'
- 'nightly'
release:
type: boolean
default: false
description: "Release"
beta:
type: boolean
default: true
description: "Beta"
draft:
type: boolean
default: true
description: "Draft"

run-name: Build ${{ inputs.version }}

env:
release-name: ${{ inputs.version }}${{ inputs.beta && ' Beta' || '' }}
release-name: ${{ inputs.version }}${{ inputs.channel == 'beta' && ' Beta' || '' }}
release-tag: ${{ inputs.channel == 'nightly' && 'nightly' || inputs.version }}

jobs:
build:
Expand Down Expand Up @@ -51,7 +59,7 @@ jobs:
node-version: 20
- name: Install NSIS via Chocolatey
run: choco install nsis --version=3.11 --no-progress
if: ${{ matrix.arch.os == 'win' }}
if: ${{ matrix.arch.os == 'win' && inputs.channel != 'nightly' }}
- uses: justalemon/VersionPatcher@v0.7.1
with:
version: ${{ inputs.version }}
Expand All @@ -66,15 +74,15 @@ jobs:
run: dotnet restore OpenUtau -r ${{ matrix.arch.rid }}

- name: Build (Windows and Linux)
run: dotnet publish OpenUtau -c Release -r ${{ matrix.arch.rid }} --self-contained true -o bin/${{ matrix.arch.name }}/
run: dotnet publish OpenUtau -c Release -r ${{ matrix.arch.rid }} --self-contained true -o bin/${{ matrix.arch.name }}/ -p:Nightly=${{ inputs.channel == 'nightly' }}
if: ${{ matrix.arch.os != 'osx' }}

- name: Build (MacOS)
run: dotnet msbuild OpenUtau -t:BundleApp -p:Configuration=Release -p:RuntimeIdentifier=${{ matrix.arch.rid }} -p:UseAppHost=true -p:SelfContained=true -p:OutputPath=../bin/${{ matrix.arch.name }}/
run: dotnet msbuild OpenUtau -t:BundleApp -p:Configuration=Release -p:RuntimeIdentifier=${{ matrix.arch.rid }} -p:UseAppHost=true -p:SelfContained=true -p:OutputPath=../bin/${{ matrix.arch.name }}/ -p:Nightly=${{ inputs.channel == 'nightly' }}
if: ${{ matrix.arch.os == 'osx' }}

- name: Write release channel info
run: "@{Beta=$${{ inputs.beta }}} | ConvertTo-Json > bin/${{ matrix.arch.name }}/prefs-default.json"
run: "@{Beta=$${{ inputs.channel == 'beta' }}} | ConvertTo-Json > bin/${{ matrix.arch.name }}/prefs-default.json"
shell: pwsh

# Create Zip
Expand Down Expand Up @@ -114,7 +122,7 @@ jobs:
with:
script-file: OpenUtau.nsi
arguments: "-DPRODUCT_VERSION=${{ inputs.version }} -DARCH=${{ matrix.arch.arch }}"
if: ${{ matrix.arch.os == 'win' }}
if: ${{ matrix.arch.os == 'win' && inputs.channel != 'nightly' }}

# Create Dmg
- name: Create Dmg
Expand Down Expand Up @@ -161,7 +169,7 @@ jobs:
with:
name: OpenUtau-${{ matrix.arch.name }}.exe
path: OpenUtau-${{ matrix.arch.name }}.exe
if: ${{ !inputs.release && matrix.arch.os == 'win' }}
if: ${{ !inputs.release && matrix.arch.os == 'win' && inputs.channel != 'nightly' }}

- uses: actions/upload-artifact@v4
with:
Expand All @@ -177,38 +185,61 @@ jobs:

# Appcast
- name: Appcast Windows
shell: cmd
shell: bash
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
python appcast.py -v=${{ inputs.version }} -o=windows -r=${{ matrix.arch.name }} -t ${{ env.release-tag }} -f=OpenUtau-${{ matrix.arch.name }}.zip
if ${{ inputs.channel != 'nightly' }}; then
python appcast.py -v=${{ inputs.version }} -o=windows -r=${{ matrix.arch.name }}-installer -f=OpenUtau-${{ matrix.arch.name }}.exe
fi
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
python appcast.py -v=${{ inputs.version }} -o=macos -r=${{ matrix.arch.name }} -t ${{ env.release-tag }} -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 }}.tar.gz
python appcast.py -v=${{ inputs.version }} -o=linux -r=${{ matrix.arch.name }} -t ${{ env.release-tag }} -f=OpenUtau-${{ matrix.arch.name }}.tar.gz
if: ${{ inputs.release && matrix.arch.os == 'linux' }}

# Release
- name: Release
uses: softprops/action-gh-release@v2
- name: Regular Release
uses: ncipollo/release-action@v1
with:
tag_name: ${{ inputs.version }}
tag: ${{ inputs.version }}
name: ${{ env.release-name }}
prerelease: ${{ inputs.beta }}
prerelease: ${{ inputs.channel != 'stable' }}
allowUpdates: true
draft: ${{ inputs.draft }}
files: |
appcast.${{ matrix.arch.name }}*.xml
OpenUtau-${{ matrix.arch.name }}.*
artifacts: "appcast.${{ matrix.arch.name }}*.xml,OpenUtau-${{ matrix.arch.name }}.*"
body: |
See [Getting Started](https://github.com/stakira/OpenUtau/wiki/Getting-Started) for how to use.

If you encountered issues, see [FAQ](https://github.com/stakira/OpenUtau/wiki/FAQ)

## macOS says "This app is damaged"
Open a terminal and run `xattr -rc /Applications/OpenUtau.app`. Try opening OpenUtau again.
if: ${{ inputs.release }}
if: ${{ inputs.release && inputs.channel != 'nightly' }}

- name: Nightly Release
uses: ncipollo/release-action@v1
with:
tag: nightly
name: Nightly
prerelease: true
allowUpdates: true
draft: ${{ inputs.draft }}
artifacts: "appcast.${{ matrix.arch.name }}*.xml,OpenUtau-${{ matrix.arch.name }}.*"
body: |
> [!WARNING]
> Nightly builds are for testing purposes only and must not use for production.
> If you encounter bugs, check the [FAQ](https://github.com/stakira/OpenUtau/wiki/FAQ) first, then open an issue if needed.

| Build Version | Commit |
| --------------------- | ----------------- |
| ${{ inputs.version }} | ${{ github.sha }} |

## macOS says "This app is damaged"
Open a terminal and run `xattr -rc /Applications/OpenUtau.app`. Try opening OpenUtau again.
if: ${{ inputs.release && inputs.channel == 'nightly' }}
42 changes: 42 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Nightly

on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes
id: check_changes
run: |
# Only trigger nightly from these folders
REGEX="^(OpenUtau(.Plugin.Builtin|.Core|)|runtimes)"
echo "changes=$(git log --since="yesterday" --name-only --oneline --pretty=format:"" | grep -m1 -E "$REGEX")" >> $GITHUB_OUTPUT
- name: Get Version
id: get_version
if: ${{ steps.check_changes.outputs.changes != '' }}
env:
GH_TOKEN: ${{ github.token }}
REPO: openutau/OpenUtau # Please modify if you want to release your fork
run: |
latest=$(gh release list --repo $REPO --json tagName --json tagName --jq 'first(.[] | select(.tagName | test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))).tagName')
nextver=$(npx -y semver -i patch ${latest})
echo fullver=${nextver}-nightly.`date +%Y%m%d` >> $GITHUB_OUTPUT
- name: Trigger Build
if: ${{ steps.check_changes.outputs.changes != '' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build.yml
inputs: '{ "channel": "nightly", "version": "${{ steps.get_version.outputs.fullver }}", "release": true, "draft": false }'
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 5
keep_minimum_runs: 5
delete_workflow_pattern: nightly
6 changes: 6 additions & 0 deletions OpenUtau/OpenUtau.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<PublishReadyToRun>true</PublishReadyToRun>
<DebugType>embedded</DebugType>
<StartupObject />
<IncludeSourceRevisionInInformationalVersion>
false
</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<PropertyGroup>
<CFBundleName>OpenUtau</CFBundleName>
Expand Down Expand Up @@ -126,4 +129,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
<DefineConstants Condition="$(Nightly) == 'true'">$(DefineConstants);NIGHTLY</DefineConstants>
</PropertyGroup>
</Project>
4 changes: 3 additions & 1 deletion OpenUtau/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public static void Main(string[] args) {
Log.Information($"{RuntimeInformation.OSDescription} " +
$"{RuntimeInformation.OSArchitecture} " +
$"{RuntimeInformation.ProcessArchitecture}");
Log.Information($"OpenUtau v{Assembly.GetEntryAssembly()?.GetName().Version} " +
Log.Information($"OpenUtau v{Assembly.GetEntryAssembly()
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion} " +
$"{RuntimeInformation.RuntimeIdentifier}");
Log.Information($"Data path = {PathManager.Inst.DataPath}");
Log.Information($"Cache path = {PathManager.Inst.CachePath}");
Expand Down
1 change: 1 addition & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="prefs.editing">Editing</system:String>
<system:String x:Key="prefs.general">General</system:String>
<system:String x:Key="prefs.note.restart">Note: please restart OpenUtau after changing this item.</system:String>
<system:String x:Key="prefs.note.nightly">Note: Switching between channels is not supported in nightly builds.</system:String>
<system:String x:Key="prefs.otoeditor">Oto Editor</system:String>
<system:String x:Key="prefs.otoeditor.select">Default Oto Editor</system:String>
<system:String x:Key="prefs.otoeditor.setparampath">setParam Path</system:String>
Expand Down
5 changes: 4 additions & 1 deletion OpenUtau/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Reactive;
using System.Threading.Tasks;
using System.Reflection;
using Avalonia.Threading;
using DynamicData.Binding;
using OpenUtau.App.Views;
Expand Down Expand Up @@ -72,7 +73,9 @@ public class MainWindowViewModel : ViewModelBase, ICmdSubscriber {

[Reactive] public string ClearCacheHeader { get; set; }
public bool ProjectSaved => !string.IsNullOrEmpty(DocManager.Inst.Project.FilePath) && DocManager.Inst.Project.Saved;
public string AppVersion => $"OpenUtau v{System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version}";
public string AppVersion => $"OpenUtau v{Assembly.GetEntryAssembly()
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion}";
[Reactive] public double Progress { get; set; }
[Reactive] public string ProgressText { get; set; }
[Reactive] public bool ShowPianoRoll { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions OpenUtau/ViewModels/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public int SafeMaxThreadCount {
[Reactive] public bool RememberVsqx { get; set; }
public string WinePath => Preferences.Default.WinePath;

#if NIGHTLY
public bool IsNightly => true;
#else
public bool IsNightly => false;
#endif

public PreferencesViewModel() {
var audioOutput = PlaybackManager.Inst.AudioOutput;
if (audioOutput != null) {
Expand Down
35 changes: 25 additions & 10 deletions OpenUtau/ViewModels/UpdaterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Reflection;
using Avalonia.Media;
using NetSparkleUpdater;
using NetSparkleUpdater.AppCastHandlers;
Expand All @@ -29,10 +30,13 @@ class GithubRelease {
public bool draft;
public bool prerelease;
public string name = string.Empty;
public string tag_name = string.Empty;
public GithubReleaseAsset[] assets = new GithubReleaseAsset[0];
#pragma warning restore 0649
}
public string AppVersion => $"v{System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version}";
public string AppVersion => $"v{Assembly.GetEntryAssembly()
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion}";
public bool IsDarkMode => ThemeManager.IsDarkMode;
[Reactive] public string UpdaterStatus { get; set; }
[Reactive] public bool UpdateAvailable { get; set; }
Expand Down Expand Up @@ -84,17 +88,28 @@ public UpdaterViewModel() {
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("User-Agent", "Other");
client.Timeout = TimeSpan.FromSeconds(30);
using var resposne = await client.GetAsync("https://api.github.com/repos/stakira/OpenUtau/releases");

#if !NIGHTLY
using var resposne = await client.GetAsync("https://api.github.com/repos/openutau/OpenUtau/releases");
#else
using var resposne = await client.GetAsync("https://api.github.com/repos/openutau/OpenUtau/releases/tags/nightly");
#endif

resposne.EnsureSuccessStatusCode();
string respBody = await resposne.Content.ReadAsStringAsync();
List<GithubRelease>? releases = JsonConvert.DeserializeObject<List<GithubRelease>>(respBody);
if (releases == null) {
return null;
}
return releases
.Where(r => !r.draft && r.prerelease == Preferences.Default.Beta)
.OrderByDescending(r => r.id)
.FirstOrDefault();

#if !NIGHTLY
List<GithubRelease>? releases = JsonConvert.DeserializeObject<List<GithubRelease>>(respBody);
if (releases == null) {
return null;
}
return releases
.Where(r => !r.draft && r.tag_name != "nightly" && r.prerelease == Preferences.Default.Beta)
.OrderByDescending(r => r.id)
.FirstOrDefault();
#else
return JsonConvert.DeserializeObject<GithubRelease>(respBody);
#endif
}

static GithubReleaseAsset? SelectAppcast(GithubRelease release) {
Expand Down
5 changes: 3 additions & 2 deletions OpenUtau/Views/PreferencesDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Grid Margin="0,5,0,0">
<Grid Margin="0,5,0,0" IsVisible="{Binding !IsNightly}">
<TextBlock Text="{DynamicResource prefs.advanced.beta}" HorizontalAlignment="Left"/>
<ToggleSwitch IsChecked="{Binding Beta}"/>
</Grid>
<TextBlock Classes="restart"/>
<TextBlock Classes="restart" IsVisible="{Binding !IsNightly}"/>
<TextBlock IsVisible="{Binding IsNightly}" Margin="0,10,0,0" Text="{DynamicResource prefs.note.nightly}"/>
</StackPanel>

<!-- Playback -->
Expand Down
4 changes: 3 additions & 1 deletion appcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ def main():
parser.add_argument('-o', '--os', help='OS name', required=True)
parser.add_argument('-r', '--rid', help='RID', required=True)
parser.add_argument('-f', '--file', help='File name', required=True)
parser.add_argument('-t', '--tag', help='Tag (Version if unspecified)')
args = parser.parse_args()

appcast_ver = args.version
appcast_os = args.os
appcast_rid = args.rid
appcast_file = args.file
appcast_tag = args.tag or args.version

xml = '''<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
Expand All @@ -31,7 +33,7 @@ def main():
</item>
</channel>
</rss>''' % (appcast_ver, datetime.now().strftime("%a, %d %b %Y %H:%M:%S %z"),
appcast_ver, appcast_file, appcast_ver, appcast_ver, appcast_os)
appcast_tag, appcast_file, appcast_ver, appcast_ver, appcast_os)

with open("appcast.%s.xml" % (appcast_rid), 'w') as f:
f.write(xml)
Expand Down
Loading