Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create deb and rpm automatically #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
88 changes: 78 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CI
on: [push, pull_request]
env:
dotnet-version: '7.0'
jobs:
build:
name: Build OpenLauncher
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4

with:
dotnet-version: '7.0.x'
dotnet-version: ${{ env.dotnet-version }}
- name: Restore
run: dotnet restore
- name: Build
Expand All @@ -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/**/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path: src/openlauncher/bin/Release/net${{ env.dotnet-version }}/${{ matrix.rid }}/publish/**/*
path: src/openlauncher/bin/Release/net${{ env.dotnet-version }}/${{ matrix.rid }}/publish/**/*
if-no-files-found: error


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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4

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
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <link_to_rpm> ```

# 🔨 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)
Expand Down
28 changes: 28 additions & 0 deletions src/openlauncher/resources/OpenLauncher.desktop
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 7 additions & 5 deletions test/IntelOrca.OpenLauncher.Tests/BuildServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using IntelOrca.OpenLauncher.Core;
using Xunit;
Expand All @@ -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);
}
}
}