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

Produce self-contained builds of the app #292

Merged
merged 6 commits into from
May 15, 2024
Merged
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
59 changes: 46 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

pack:
strategy:
matrix:
rid:
- win-arm64
- win-x86
- win-x64

# Needs to run on Windows to create the installer
runs-on: windows-latest
timeout-minutes: 10

Expand All @@ -95,7 +103,8 @@ jobs:
-p:CSharpier_Bypass=true
--output LightBulb/bin/publish/
--configuration Release
--use-current-runtime
--runtime ${{ matrix.rid }}
--self-contained

- name: Create installer
shell: pwsh
Expand All @@ -109,18 +118,18 @@ jobs:
- name: Upload artifacts (portable)
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: LightBulb
name: LightBulb.${{ matrix.rid }}
path: LightBulb/bin/publish/
if-no-files-found: error

- name: Upload artifacts (installer)
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: LightBulb-Installer
name: LightBulb-Installer.${{ matrix.rid }}
path: Installer/bin/LightBulb-Installer.exe
if-no-files-found: error

deploy:
release:
if: ${{ github.ref_type == 'tag' }}

needs:
Expand All @@ -131,6 +140,33 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
contents: write

steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create ${{ github.ref_name }}
--repo ${{ github.event.repository.full_name }}
--title ${{ github.ref_name }}
--generate-notes
--verify-tag

deploy:
needs: release

strategy:
matrix:
rid:
- win-arm64
- win-x86
- win-x64

runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
actions: read
contents: write
Expand All @@ -139,30 +175,27 @@ jobs:
- name: Download artifacts (portable)
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: LightBulb
name: LightBulb.${{ matrix.rid }}
path: LightBulb/

- name: Download artifacts (installer)
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: LightBulb-Installer
name: LightBulb-Installer.${{ matrix.rid }}

- name: Create package (portable)
# Change into the artifacts directory to avoid including the directory itself in the zip archive
working-directory: LightBulb/
run: zip -r ../LightBulb.zip .
run: zip -r ../LightBulb.${{ matrix.rid }}.zip .

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create ${{ github.ref_name }}
LightBulb.zip
LightBulb-Installer.exe
gh release upload ${{ github.ref_name }}
LightBulb.${{ matrix.rid }}.zip
LightBulb-Installer.${{ matrix.rid }}.exe
--repo ${{ github.event.repository.full_name }}
--title ${{ github.ref_name }}
--generate-notes
--verify-tag

notify:
needs: deploy
Expand Down
1 change: 0 additions & 1 deletion LightBulb/LightBulb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<PackageReference Include="CSharpier.MsBuild" Version="0.28.2" PrivateAssets="all" />
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="DialogHost.Avalonia" Version="0.7.7" />
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.4" PrivateAssets="all" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
<PackageReference Include="Material.Avalonia" Version="3.5.0" />
<PackageReference Include="Material.Icons.Avalonia" Version="2.1.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
Expand Down
11 changes: 10 additions & 1 deletion LightBulb/Services/UpdateService.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 Onova;
using Onova.Exceptions;
Expand All @@ -10,7 +11,15 @@ namespace LightBulb.Services;
public class UpdateService(SettingsService settingsService) : IDisposable
{
private readonly IUpdateManager _updateManager = new UpdateManager(
new GithubPackageResolver("Tyrrrz", "LightBulb", "LightBulb.zip"),
new GithubPackageResolver(
"Tyrrrz",
"LightBulb",
// Examples:
// LightBulb.win-arm64.zip
// LightBulb.win-x64.zip
// LightBulb.linux-x64.zip
$"LightBulb.{RuntimeInformation.RuntimeIdentifier}.zip"
),
new ZipPackageExtractor()
);

Expand Down
5 changes: 2 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me
- 🟠 [CI build](https://github.com/Tyrrrz/LightBulb/actions/workflows/main.yml)
- 📦 [WinGet](https://github.com/microsoft/winget-cli): `winget install Tyrrrz.LightBulb` (community-maintained)

> **Warning**:
> **LightBulb** only works on Windows 7 and higher.
> Other operating systems are not supported.
> **Note**:
> If you're unsure which build is right for your system, consult with [this page](https://useragent.cc) to determine your OS and CPU architecture.

## Features

Expand Down