Skip to content

Commit

Permalink
Merge pull request #12 from Sewer56/add-nuget-support-core
Browse files Browse the repository at this point in the history
Enhancement: Build NuGet packages, cleanup and dependency-free packages
  • Loading branch information
halgari authored Mar 26, 2023
2 parents edac832 + 6bc9250 commit 0e4a1fe
Show file tree
Hide file tree
Showing 77 changed files with 331 additions and 958 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build and Publish

on:
push:
branches: [ core, add-nuget-support-core ]
tags:
- '*'
pull_request:
branches: [ core, add-nuget-support-core ]
workflow_dispatch:

env:
PUBLISH_CHANGELOG_PATH: ./Publish/Changelog.md
PUBLISH_PACKAGES_PATH: ./Publish/Packages
PUBLISH_PATH: ./Publish
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') }}
RELEASE_TAG: ${{ github.ref_name }}

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Print Environment Variables
run: |
echo "Changelog Path: $env:PUBLISH_CHANGELOG_PATH"
echo "Publish Path: $env:PUBLISH_PATH"
echo "Is Release?: $env:IS_RELEASE"
echo "Release Tag: $env:RELEASE_TAG"
- name: Setup .NET Core SDK (7.0.x)
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Setup AutoChangelog
run: npm install -g auto-changelog

- name: Get Dotnet Info
run: dotnet --info

- name: Restore dependencies
run: dotnet restore ./FomodInstaller.sln

- name: Build
run: dotnet build -c Release ./FomodInstaller.sln --no-restore

- name: Test # We don't have any right now
run: dotnet test -c Release ./FomodInstaller.sln --no-build --verbosity normal

- name: Create NuGet Package Artifacts
run: |
[System.IO.Directory]::CreateDirectory("$env:PUBLISH_PACKAGES_PATH")
$items = Get-ChildItem -Path "." -Recurse -Include '*.nupkg'
foreach ($item in $items)
{
Write-Host "Moving $item -> $env:PUBLISH_PACKAGES_PATH"
Move-Item -Path "$item" -Destination "$env:PUBLISH_PACKAGES_PATH"
}
- name: Create Changelog (on Tag)
run: |
[System.IO.Directory]::CreateDirectory("$env:PUBLISH_PATH")
if ($env:IS_RELEASE -eq 'true')
{
auto-changelog --sort-commits date --hide-credit --template changelog-template.hbs --commit-limit false --unreleased --starting-version "$env:RELEASE_TAG" --output "$env:PUBLISH_CHANGELOG_PATH"
}
else
{
auto-changelog --sort-commits date --hide-credit --template changelog-template.hbs --commit-limit false --unreleased --output "$env:PUBLISH_CHANGELOG_PATH"
}
- name: Upload NuGet Artifacts
uses: actions/upload-artifact@v3
with:
# Artifact name
name: NuGet Packages
# A file, directory or wildcard pattern that describes what to upload
path: ${{ env.PUBLISH_PACKAGES_PATH }}/*
retention-days: 0

- name: Upload Changelog Artifact
uses: actions/upload-artifact@v3
with:
# Artifact name
name: Changelog
# A file, directory or wildcard pattern that describes what to upload
path: ${{ env.PUBLISH_CHANGELOG_PATH }}
retention-days: 0

- name: Upload to GitHub Releases
uses: softprops/[email protected]
if: env.IS_RELEASE == 'true'
with:
# Path to load note-worthy description of changes in release from
body_path: ${{ env.PUBLISH_CHANGELOG_PATH }}
# Newline-delimited list of path globs for asset files to upload
files: |
${{ env.PUBLISH_PATH }}/**
- name: Upload to NuGet (on Tag)
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
if: env.IS_RELEASE == 'true'
run: |
$items = Get-ChildItem -Path "$env:PUBLISH_PACKAGES_PATH/*.nupkg"
Foreach ($item in $items)
{
Write-Host "Pushing $item"
dotnet nuget push "$item" -k "$env:NUGET_KEY" -s "https://api.nuget.org/v3/index.json" --skip-duplicate
}
4 changes: 1 addition & 3 deletions FomodInstaller.Interface/Extension/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text;

namespace FomodInstaller.Extensions
{
Expand Down
25 changes: 11 additions & 14 deletions FomodInstaller.Interface/FomodInstaller.Interface.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- NuGet Package Shared Details -->
<Import Project="$([MSBuild]::GetPathOfFileAbove('NuGet.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Title>FOMOD Installer Library</Title>
<Description>Front-end interface for Nexus Mods' FOMOD installer implementation.</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Utils\Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.1.2" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.326103">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
</ItemGroup>
</Project>
9 changes: 2 additions & 7 deletions FomodInstaller.Interface/ModInstaller/ArchiveStructure.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using FomodInstaller.Extensions;
using Utils;
using System.Text.RegularExpressions;
using FomodInstaller.Utils;

namespace FomodInstaller.Interface
{
Expand Down
2 changes: 0 additions & 2 deletions FomodInstaller.Interface/ModInstaller/BaseInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using FomodInstaller.Interface;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace FomodInstaller.ModInstaller
{
Expand Down
5 changes: 0 additions & 5 deletions FomodInstaller.Interface/ModInstaller/CoreDelegates.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using FomodInstaller.Interface.ui;
using Microsoft.CSharp.RuntimeBinder;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Utils;

namespace FomodInstaller.Interface
{
Expand Down
2 changes: 0 additions & 2 deletions FomodInstaller.Interface/ModInstaller/IInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using FomodInstaller.Interface;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace FomodInstaller.ModInstaller
{
Expand Down
5 changes: 1 addition & 4 deletions FomodInstaller.Interface/ModInstaller/Instruction.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.IO;
using System.Linq;

namespace FomodInstaller.Interface
namespace FomodInstaller.Interface
{
public struct Instruction
{
Expand Down
11 changes: 2 additions & 9 deletions FomodInstaller.Interface/ModInstaller/Mod.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using FomodInstaller.Extensions;
using FomodInstaller.Scripting;
using Utils;
using FomodInstaller.Scripting;
using FomodInstaller.Utils;

namespace FomodInstaller.Interface
{
Expand Down
4 changes: 1 addition & 3 deletions FomodInstaller.Interface/Scripting/IScriptExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using FomodInstaller.Interface;
using FomodInstaller.Interface;

namespace FomodInstaller.Scripting
{
Expand Down
4 changes: 1 addition & 3 deletions FomodInstaller.Interface/Scripting/IScriptType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using FomodInstaller.Interface;
using FomodInstaller.Interface;

namespace FomodInstaller.Scripting
{
Expand Down
4 changes: 1 addition & 3 deletions FomodInstaller.Interface/Scripting/IScriptTypeRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;

namespace FomodInstaller.Scripting
namespace FomodInstaller.Scripting
{
/// <summary>
/// Describes the properties and methods of a script type registry.
Expand Down
5 changes: 1 addition & 4 deletions FomodInstaller.Interface/Scripting/ScriptExecutorBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FomodInstaller.Interface;
using FomodInstaller.Interface;

namespace FomodInstaller.Scripting
{
Expand Down
Loading

0 comments on commit 0e4a1fe

Please sign in to comment.