diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aacfe1a..149359d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,7 @@ name: CI on: [push, pull_request] +env: + dotnet-version: '7.0' jobs: build: name: Build OpenLauncher @@ -17,9 +19,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.0.x' + dotnet-version: ${{ env.dotnet-version }} - name: Restore run: dotnet restore - name: Build @@ -30,14 +32,80 @@ jobs: working-directory: src/openlauncher run: dotnet publish -c Release -r ${{ matrix.rid }} --self-contained - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: "OpenLauncher-${{ matrix.rid }}" - path: src/openlauncher/bin/Release/net7.0/${{ matrix.rid }}/publish/**/* - - name: Create release - uses: softprops/action-gh-release@v1 + path: src/openlauncher/bin/Release/net${{ env.dotnet-version }}/${{ matrix.rid }}/publish/**/* + + package: + name: deb and rpm packaging + runs-on: ubuntu-latest + needs: [build] if: startsWith(github.ref, 'refs/tags/v') - with: - files: | - src/openlauncher/bin/Release/net7.0/${{ matrix.rid }}/publish/openlauncher - src/openlauncher/bin/Release/net7.0/${{ matrix.rid }}/publish/openlauncher.exe + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.dotnet-version }} + - name: Restore + run: dotnet restore + - name: Publish + working-directory: src/openlauncher + run: dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:SelfContained=false -p UseAppHost=true -p:EnableCompressionInSingleFile=false # Build to use OS runtime, has to be architecture dependent per documentation :( + - name: Prepare to create deb and rpm files + run: | + mkdir -p .pkg/usr/bin + mkdir -p .pkg/usr/share/applications + mkdir -p .pkg/usr/share/icons + cp src/openlauncher/resources/logo.svg .pkg/usr/share/icons/openlauncher.svg + cp src/openlauncher/resources/OpenLauncher.desktop .pkg/usr/share/applications/OpenLauncher.desktop + cp src/openlauncher/bin/Release/net${{ env.dotnet-version }}/linux-x64/publish/openlauncher .pkg/usr/bin/openlauncher + chmod +x .pkg/usr/bin/openlauncher + - name: Create rpm + uses: jiro4989/build-rpm-action@v2 + with: + package: openlauncher + summary: 'A launcher for automatically downloading the latest, or specific versions of OpenRCT2 and OpenLoco.' + package_root: .pkg + maintainer: Ted John + version: ${{github.ref_name}} # refs/tags/v*.*.* + arch: 'x86_64' + license: 'MIT' + requires: dotnet-runtime-${{ env.dotnet-version }} + - name: Create deb + uses: jiro4989/build-deb-action@v3 + with: + package: openlauncher + package_root: .pkg + maintainer: Ted John + version: ${{github.ref_name}} # refs/tags/v*.*.* + arch: 'amd64' + desc: 'A launcher for automatically downloading the latest, or specific versions of OpenRCT2 and OpenLoco.' + depends: dotnet-runtime-${{ env.dotnet-version }} + - uses: actions/upload-artifact@v4 + with: + name: artifact-deb-rpm + path: | + ./*.deb + ./*.rpm + !./*-debuginfo-*.rpm + + release: + name: Create release + runs-on: ubuntu-latest + needs: [build, package] + steps: + - uses: actions/download-artifact@v4 + with: + merge-multiple: true + path: artifacts/ + - uses: softprops/action-gh-release@v1 + with: + files: | + # List to exclude pdb + artifacts/openlauncher + artifacts/openlauncher*.exe + artifacts/openlauncher*.rpm + artifacts/openlauncher*.deb diff --git a/README.md b/README.md index ed30f23..1a94864 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,23 @@ A launcher for automatically downloading the latest, or specific versions of [Op # 🚀 Installation 1. Download the latest version of the launcher from the [Releases page](https://github.com/IntelOrca/OpenLauncher/releases). 2. Save the file anywhere on your system and run it. - +## Debian/Ubuntu +1. Download the .deb file from the [Releases page](https://github.com/IntelOrca/OpenLauncher/releases). +2. Run this command as root in the location you've downloaded the .deb file to + + ``` apt install -f openlauncher-*.deb ``` +## Fedora +1. Copy the link to the .rpm file from the [Releases page](https://github.com/IntelOrca/OpenLauncher/releases). +2. Run this command as root + + ``` yum localinstall ``` + # 🔨 Building **Open Launcher** is written in C# using the [AvaloniaUI](http://avaloniaui.net) framework. The application currently targets [.NET 6](https://dotnet.microsoft.com) and is typically distributed as a self contained executable. ### Prerequisites -* [.NET 6 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) +* [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) * [Visual Studio](https://visualstudio.microsoft.com) (optional) * [AvaloniaUI extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS) (optional) * [Visual Studio Code](https://code.visualstudio.com) (optional) diff --git a/src/openlauncher/resources/OpenLauncher.desktop b/src/openlauncher/resources/OpenLauncher.desktop new file mode 100644 index 0000000..bed52dd --- /dev/null +++ b/src/openlauncher/resources/OpenLauncher.desktop @@ -0,0 +1,28 @@ +[Desktop Entry] + +# The type as listed above +Type=Application + +# The version of the desktop entry specification to which this file complies +Version=1.0 + +# The name of the application +Name=OpenLauncher + +# A comment which can/will be used as a tooltip +Comment=A launcher for automatically downloading the latest, or specific versions of OpenRCT2 and OpenLoco. + +# The path to the folder in which the executable is run +Path=/usr/bin + +# The executable of the application, possibly with arguments. +Exec=openlauncher + +# The name of the icon that will be used to display this entry +Icon=openlauncher + +# Describes whether this application needs to be run in a terminal or not +Terminal=false + +# Describes the categories in which this entry should be shown +Categories=Game; diff --git a/test/IntelOrca.OpenLauncher.Tests/BuildServiceTests.cs b/test/IntelOrca.OpenLauncher.Tests/BuildServiceTests.cs index 953354c..49d8962 100644 --- a/test/IntelOrca.OpenLauncher.Tests/BuildServiceTests.cs +++ b/test/IntelOrca.OpenLauncher.Tests/BuildServiceTests.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Runtime.InteropServices; using System.Threading.Tasks; using IntelOrca.OpenLauncher.Core; using Xunit; @@ -13,13 +14,14 @@ public async Task GetBuildsAsync_OpenLoco_v22_05_1() { var buildService = new BuildService(); var builds = await buildService.GetBuildsAsync(Game.OpenLoco, includeDevelop: false); - var build = builds.First(x => x.Version == "v22.05.1"); + var build = builds.First(b => b.Version == "v22.05.1"); + var buildAsset = build.Assets.First(ba => ba.Platform == OSPlatform.OSX); Assert.Equal("v22.05.1", build.Version); Assert.Equal(new DateTime(2022, 5, 17, 20, 6, 15), build.PublishedAt); - Assert.Equal("OpenLoco-v22.05.1-macos.zip", build.Assets[0].Name); - Assert.Equal(new Uri("https://github.com/OpenLoco/OpenLoco/releases/download/v22.05.1/OpenLoco-v22.05.1-macos.zip"), build.Assets[0].Uri); - Assert.Equal("application/x-zip-compressed", build.Assets[0].ContentType); - Assert.Equal(4157592, build.Assets[0].Size); + Assert.Equal("OpenLoco-v22.05.1-macos.zip", buildAsset.Name); + Assert.Equal(new Uri("https://github.com/OpenLoco/OpenLoco/releases/download/v22.05.1/OpenLoco-v22.05.1-macos.zip"), buildAsset.Uri); + Assert.Equal("application/x-zip-compressed", buildAsset.ContentType); + Assert.Equal(4157592, buildAsset.Size); } } }