-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feature/cake frosting (#92) * Added games list Add list of games made with MonoGame.Aseprite * Always specify generate documentation file * Switch to Cake Frosting * Update workflow script * Issue/try get slice 92 (#94) * Added MonoGame.Aseprite to Test .sln This is so intellesense would pickup correct * Added test for issue #92 * Use `_slices` and not `_tags` The `AsepriteSlice.TryGetSlice(string, out AsepriteSlice?)` method incorrectly searched the `_tags` array and not the `_slices` array. This resolves issue #92 * Bump version number * Update release notes
- Loading branch information
1 parent
8d92eeb
commit ce5f41a
Showing
22 changed files
with
372 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Cake.Frosting" Version="3.1.0" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build.csproj", "{86E7FFCA-81BE-403B-A2EE-61D4C8526111}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{86E7FFCA-81BE-403B-A2EE-61D4C8526111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{86E7FFCA-81BE-403B-A2EE-61D4C8526111}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{86E7FFCA-81BE-403B-A2EE-61D4C8526111}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{86E7FFCA-81BE-403B-A2EE-61D4C8526111}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.IO; | ||
using Cake.Common; | ||
using Cake.Common.Build; | ||
using Cake.Common.Xml; | ||
using Cake.Core; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
public sealed class BuildContext : FrostingContext | ||
{ | ||
public readonly string ArtifactsDirectory; | ||
public readonly string Version; | ||
public readonly string? RepositoryOwner; | ||
public readonly string? RepositoryUrl; | ||
public readonly bool IsTag; | ||
public readonly bool IsRunningOnGitHubActions; | ||
public readonly string? GitHubToken; | ||
public readonly string? NuGetAccessToken; | ||
public readonly string MonoGameAsepritePath; | ||
public readonly string MonoGameAsepriteContentPipelinePath; | ||
public readonly string MonoGameAsepriteTestsPath; | ||
|
||
public BuildContext(ICakeContext context) : base(context) | ||
{ | ||
ArtifactsDirectory = context.Argument(nameof(ArtifactsDirectory), ".artifacts"); | ||
MonoGameAsepritePath = context.Argument(nameof(MonoGameAsepritePath), "source/MonoGame.Aseprite/MonoGame.Aseprite.csproj"); | ||
MonoGameAsepriteContentPipelinePath = context.Argument(nameof(MonoGameAsepriteContentPipelinePath), "source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj"); | ||
MonoGameAsepriteTestsPath = context.Argument(nameof(MonoGameAsepriteTestsPath), "tests/MonoGame.Aseprite.Tests/MonoGame.Aseprite.Tests.csproj"); | ||
Version = context.XmlPeek("source/MonoGame.Aseprite/MonoGame.Aseprite.csproj", "/Project/PropertyGroup/Version"); | ||
|
||
IsRunningOnGitHubActions = context.BuildSystem().IsRunningOnGitHubActions; | ||
if (IsRunningOnGitHubActions) | ||
{ | ||
RepositoryOwner = context.EnvironmentVariable("GITHUB_REPOSITORY_OWNER"); | ||
RepositoryUrl = $"https://github.com/{context.EnvironmentVariable("GITHUB_REPOSITORY")}"; | ||
GitHubToken = context.EnvironmentVariable("GITHUB_TOKEN"); | ||
IsTag = context.EnvironmentVariable("GITHUB_REF_TYPE") == "tag"; | ||
|
||
if (IsTag) | ||
{ | ||
NuGetAccessToken = context.EnvironmentVariable("NUGET_ACCESS_TOKEN"); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.Build; | ||
using Cake.Common.Tools.DotNet.MSBuild; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(BuildTask))] | ||
public sealed class BuildTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
DotNetMSBuildSettings msBuildSettings = new DotNetMSBuildSettings(); | ||
msBuildSettings.WithProperty("Version", context.Version); | ||
|
||
DotNetBuildSettings buildSettings = new DotNetBuildSettings() | ||
{ | ||
MSBuildSettings = msBuildSettings, | ||
Configuration = "Release", | ||
Verbosity = DotNetVerbosity.Minimal, | ||
NoLogo = true | ||
}; | ||
|
||
context.DotNetBuild(context.MonoGameAsepritePath, buildSettings); | ||
context.DotNetBuild(context.MonoGameAsepriteContentPipelinePath, buildSettings); | ||
context.DotNetBuild(context.MonoGameAsepriteTestsPath, buildSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.NuGet.Push; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(DeployToGitHubTask))] | ||
public sealed class DeployToGitHubTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => context.IsRunningOnGitHubActions; | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
DotNetNuGetPushSettings pushSettings = new DotNetNuGetPushSettings() | ||
{ | ||
Source = $"https://nuget.pkg.github.com/{context.RepositoryOwner}/index.json", | ||
ApiKey = context.GitHubToken | ||
}; | ||
|
||
context.DotNetNuGetPush($"{context.ArtifactsDirectory}/*.nupkg", pushSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.NuGet.Push; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(DeployToNuGetTask))] | ||
public sealed class DeployToNuGetTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => | ||
context.IsRunningOnGitHubActions && | ||
context.IsTag && | ||
!string.IsNullOrEmpty(context.RepositoryOwner) && | ||
context.RepositoryOwner.Equals("AristurtleDev", StringComparison.InvariantCultureIgnoreCase); | ||
|
||
|
||
public override void Run(BuildContext context) | ||
{ | ||
DotNetNuGetPushSettings pushSettings = new DotNetNuGetPushSettings() | ||
{ | ||
Source = "https://api.nuget.org/v3/index.json", | ||
ApiKey = context.NuGetAccessToken | ||
}; | ||
|
||
context.DotNetNuGetPush($"{context.ArtifactsDirectory}/*.nupkg", pushSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Cake.Common.IO; | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.MSBuild; | ||
using Cake.Common.Tools.DotNet.Pack; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(PackageTask))] | ||
public sealed class PackageTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
context.CleanDirectory(context.ArtifactsDirectory); | ||
context.CreateDirectory(context.ArtifactsDirectory); | ||
|
||
DotNetMSBuildSettings msBuildSettings = new DotNetMSBuildSettings(); | ||
msBuildSettings.WithProperty("Version", context.Version); | ||
msBuildSettings.WithProperty("PackageVersion", context.Version); | ||
|
||
DotNetPackSettings packSettings = new DotNetPackSettings() | ||
{ | ||
Configuration = "Release", | ||
OutputDirectory = context.ArtifactsDirectory, | ||
MSBuildSettings = msBuildSettings | ||
}; | ||
|
||
context.DotNetPack(context.MonoGameAsepritePath, packSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Threading.Tasks; | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
public static class Program | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
return new CakeHost() | ||
.UseContext<BuildContext>() | ||
.UseWorkingDirectory("../") | ||
.Run(args); | ||
} | ||
} | ||
|
||
[TaskName("Default")] | ||
[IsDependentOn(typeof(RestoreTask))] | ||
[IsDependentOn(typeof(BuildTask))] | ||
[IsDependentOn(typeof(TestTask))] | ||
[IsDependentOn(typeof(PackageTask))] | ||
public sealed class DefaultTask : FrostingTask {} | ||
|
||
[TaskName("Deploy")] | ||
[IsDependentOn(typeof(DeployToGitHubTask))] | ||
[IsDependentOn(typeof(DeployToNuGetTask))] | ||
public sealed class DeployTask : FrostingTask {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.Restore; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(RestoreTask))] | ||
public sealed class RestoreTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
DotNetRestoreSettings restoreSettings = new DotNetRestoreSettings() | ||
{ | ||
Verbosity = DotNetVerbosity.Quiet | ||
}; | ||
context.DotNetRestore(context.MonoGameAsepritePath, restoreSettings); | ||
context.DotNetRestore(context.MonoGameAsepriteContentPipelinePath, restoreSettings); | ||
context.DotNetRestore(context.MonoGameAsepriteTestsPath, restoreSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Common.Tools.DotNet.Test; | ||
using Cake.Frosting; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName(nameof(TestTask))] | ||
public sealed class TestTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
DotNetTestSettings testSettings = new DotNetTestSettings() | ||
{ | ||
Configuration = "Release", | ||
}; | ||
context.DotNetTest(context.MonoGameAsepriteTestsPath, testSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,60 @@ | ||
name: build-and-test | ||
on: | ||
push: | ||
tags: [v*] | ||
pull_request: | ||
branches: | ||
- 'release' | ||
- 'main' | ||
branches: ['main'] | ||
|
||
|
||
env: | ||
DOTNET_VERSION: '6.0.400' | ||
|
||
|
||
jobs: | ||
build: | ||
build-test-pack-job: | ||
name: "Build-Test-Pack" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone Repository | ||
- name: "Clone Repository" | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup .NET | ||
- name: "Setup .NET" | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Cake Target Test | ||
shell: bash | ||
run: | | ||
cd ./.tools | ||
dotnet tool restore | ||
dotnet cake --target=Test | ||
- name: "CAKE (Build -> Test -> Package)" | ||
run: dotnet run --project ./.build/Build.csproj -- --target=Default | ||
|
||
- name: "Upload Artifacts For Deploy" | ||
if: github.event_name != 'pull_request' | ||
uses: actions/upload-artifact@main | ||
with: | ||
name: MonoGame.Aseprite | ||
path: ./artifacts/* | ||
|
||
deploy-job: | ||
name: "Deploy NuGets" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
needs: [build-test-pack-job] | ||
if: ${{ github.event_name == 'push' }} | ||
steps: | ||
- name: "Clone Repository" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Download Artifacts For Deploy" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: MonoGame.Aseprite | ||
path: artifacts | ||
|
||
- name: "Push Packages" | ||
run: dotnet run --project ./.build/Build.csproj -- --target=Deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NUGET_ACCESS_TOKEN: ${{ secrets.NUGET_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.