Skip to content

Commit

Permalink
Support packaging executables and sending them to a GitHub release
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAman62 committed May 9, 2024
1 parent 6dcf664 commit fddac6c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 19 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: CI & Package
name: CI

on:
push:
Expand All @@ -24,12 +21,7 @@ jobs:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Publish
run: dotnet publish --no-restore
- name: Build
run: dotnet build --no-restore -c Debug
- name: Test
run: dotnet test --no-build --verbosity normal -c Release
- name: Pack
run: dotnet pack --no-build
- name: Push Packages
run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate

run: dotnet test --no-build --verbosity normal -c Debug
35 changes: 35 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Package and Publish to NuGet

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Publish
run: dotnet publish --no-restore
- name: Pack
run: dotnet pack --no-build
- name: Push Packages
run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate

- name: Create MacOS arm64 Package
run: dotnet publish -r osx-arm64 --self-contained true -p:PublishSingleFile=true OpenF1.Console/OpenF1.Console.csproj -o osx-arm64-output
- name: Upload MaxOS arm64 to Release
uses: svenstaro/upload-release-action@v2
with:
file: osx-arm64-output
asset_name: openf1-console-macos-arm64
6 changes: 2 additions & 4 deletions OpenF1.Console/Display/MainDisplay.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection;
using Spectre.Console;
using Spectre.Console.Rendering;

Expand All @@ -8,10 +9,7 @@ public class MainDisplay() : IDisplay
public Screen Screen => Screen.Main;

private readonly FigletFont _font = FigletFont.Load(
Path.Join(
Directory.GetParent(AppContext.BaseDirectory)!.FullName,
"/slant.flf"
)
Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenF1.Console.slant.flf")!
);

public Task<IRenderable> GetContentAsync()
Expand Down
7 changes: 4 additions & 3 deletions OpenF1.Console/OpenF1.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
</ItemGroup>

<ItemGroup>
<None Update="*.flf" Pack="true">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="*.flf" />
</ItemGroup>

<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

Expand Down

0 comments on commit fddac6c

Please sign in to comment.