Skip to content

Commit

Permalink
Merge pull request #57 from nils-a/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
nils-a authored Jul 16, 2024
2 parents c766808 + 11d31ad commit ecdfd52
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/Cake.Discord/Cake.Discord.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
Expand Down
2 changes: 1 addition & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<CakeVersion>1.0.0</CakeVersion>
<CakeVersion>2.0.0</CakeVersion>
</PropertyGroup>
</Project>
13 changes: 13 additions & 0 deletions demo/dsl/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.0.0",
"commands": [
"dotnet-cake"
],
"rollForward": false
}
}
}
16 changes: 10 additions & 6 deletions demo/dsl/discord.cake
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#r "../../Source/Cake.Discord/bin/Debug/netstandard2.0/Cake.Discord.dll"
#r "../../Source/Cake.Discord/bin/Debug/net6.0/Cake.Discord.dll"
//#addin "nuget:https://www.nuget.org/api/v2?package=Cake.Discord"

var url = Argument<string>("url", null);

var cakeAssembly = typeof(ICakeContext).Assembly.GetName();
var cakeName = $"{cakeAssembly.Name ?? "UNKNOWN"} v{cakeAssembly.Version?.ToString() ?? "??.??.??"}";

if (string.IsNullOrEmpty(url))
{
Error("you need to pass a webhook url via `--url=...`");
Expand All @@ -15,7 +18,7 @@ try

var postMessageResult = Discord.Chat.PostMessage(
webHookUrl:url,
content:"This is a normal message."
content:$"This is a normal message from {cakeName}."
);

if (postMessageResult.Ok)
Expand All @@ -38,7 +41,7 @@ try

var postMessageResult = Discord.Chat.PostMessage(
webHookUrl:url,
content:"This is a TTS message.",
content:$"This is a TTS message from {cakeName}.",
messageSettings:new DiscordChatMessageSettings { Tts = true }
);

Expand All @@ -62,9 +65,9 @@ try

var postMessageResult = Discord.Chat.PostMessage(
webHookUrl:url,
content:"This is a custom avatar and name message.",
content:$"This is a custom avatar and name message from {cakeName}.",
messageSettings:new DiscordChatMessageSettings {
UserName = "gep13",
UserName = cakeName,
AvatarUrl = new Uri("https://avatars0.githubusercontent.com/u/1271146?s=400&v=4")
}
);
Expand All @@ -89,7 +92,7 @@ try

var postMessageResult = Discord.Chat.PostMessage(
webHookUrl:url,
content:"This _is_ a `message` with custom formatting from *CakeBuild* using incoming web hook:thumbsup:\r\n```Here is some code```"
content:$"This _is_ a `message` with custom formatting from *CakeBuild* using incoming web hook:thumbsup:\r\n```Here is some code``` from {cakeName}"
);

if (postMessageResult.Ok)
Expand All @@ -106,4 +109,5 @@ catch(Exception ex)
Error("{0}", ex);
}

Information("Any key to continue.");
Console.ReadLine();
11 changes: 11 additions & 0 deletions demo/dsl/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Set-Location -LiteralPath $PSScriptRoot

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:DOTNET_NOLOGO = '1'

dotnet tool restore
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

dotnet cake discord.cake @args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
12 changes: 12 additions & 0 deletions demo/dsl/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euox pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1

dotnet tool restore

dotnet cake discord.cake "$@"

0 comments on commit ecdfd52

Please sign in to comment.