Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DSharpPlus/Bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
akiraveliara committed Jul 31, 2023
2 parents 98ebca4 + 8c211a7 commit 90d3358
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 48 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
push:
paths:
- ".github/workflows/publish.yml"
- "src/Bundles/Bundles.csproj"
- "tests/Bundles.Tests/Bundles.Tests.csproj"
- "Directory.Build.props"
- "Directory.Packages.props"

env:
DOTNET_NOLOGO: 1
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Regenerate Resource Files

on:
push:
paths:
- ".github/workflows/resources.yml"
- "res/**"
- "tools/generate-assets.sh"
workflow_dispatch:

jobs:
regenerate-assets:
name: Regenerate Resource Files
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Assets
run: tools/generate-assets.sh
37 changes: 18 additions & 19 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
<Project>

<!-- build -->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<LangVersion>preview</LangVersion>
<NoWarn>$(NoWarn);CS1591</NoWarn>

<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<!-- build and versioning setup -->
<ManagePackageVersionsCentrally>True</ManagePackageVersionsCentrally>
<UseArtifactsOutput>true</UseArtifactsOutput>
<NuGetAudit>true</NuGetAudit>

<UseArtifactsOutput>true</UseArtifactsOutput>
<!-- sourcelink -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<!-- nuget -->
<PropertyGroup>
<Authors>
akiraveliara, dotnet/corefxlab SlimDictionary contributors
</Authors>
<Description>A collection of collections and related types of varying usefulness.</Description>
<Authors>Akiraveliara, dotnet/corefxlab SlimDictionary contributors</Authors>
<Company>DSharpPlus Contributors</Company>
<Description>A collection of collections and related types of varying usefulness.</Description>
<PackageIcon>logo.png</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/DSharpPlus/Bundles</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/DSharpPlus/Bundles</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageLicenseExpression>MPL</PackageLicenseExpression>
<PackageIcon>dsharpplus.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/DSharpPlus/DSharpPlus/master/logo/dsharpplus.png</PackageIconUrl>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="../../LICENSE" Pack="true" PackagePath=""/>
<EmbeddedResource Include="../../README.md" Pack="true" PackagePath=""/>
<EmbeddedResource Include="../../res/logo.png" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
Binary file added res/logo.ico
Binary file not shown.
Binary file added res/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions res/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions src/Bundles/Bundles.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsAotCompatible>true</IsAotCompatible>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsAotCompatible>true</IsAotCompatible>
<OutputType>Library</OutputType>
<PackageId>Bundles</PackageId>
</PropertyGroup>

</Project>
</Project>
33 changes: 10 additions & 23 deletions tests/Bundles.Tests/Bundles.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Bundles\Bundles.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="System.Net.Http"/>
<PackageReference Include="System.Text.RegularExpressions"/>
<PackageReference Include="coverlet.collector" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" PrivateAssets="all"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" PrivateAssets="all"/>
<ProjectReference Include="../../src/Bundles/Bundles.csproj"/>
</ItemGroup>

</Project>
</Project>
47 changes: 47 additions & 0 deletions tools/generate-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Deps
xbps-install -Syu > /dev/null
xbps-install -y ImageMagick yarn > /dev/null
yarn global add svgo > /dev/null

# Functions
regenerate()
{
echo "Generating assets for $1"

# Optimize the SVG file
svgo --multipass --quiet "$1"

# Convert to PNG
convert -size 1024x1024 -background transparent "$1" "${1%.*}.png"

# Convert to ICO
# https://stackoverflow.com/a/15104985
convert -background transparent -colors 256 "$1" \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
\( -clone 0 -resize 128x128 \) \
\( -clone 0 -resize 256x256 \) \
-delete 0 "${1%.*}.ico"
}

# Iterate over each file matching the pattern "*.svg" in the "res" directory
for file in res/*.svg; do
# Execute the "regenerate" command on each file
regenerate "$file"
done

# Check if any files were modified
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add res > /dev/null
git diff-index --quiet HEAD
if [ "$?" == "1" ]; then
git commit -m "[ci-skip] Regenerate resource files." > /dev/null
git push > /dev/null
else
echo "No resource files were modified."
fi

0 comments on commit 90d3358

Please sign in to comment.