build: automatic versioning and publishing

This commit is contained in:
Kyle Ratti 2022-11-30 23:28:31 -05:00
parent e904ac67bd
commit 7a4c9ffa58
No known key found for this signature in database
GPG Key ID: 067C5D2D7C62E0F8
9 changed files with 150 additions and 33 deletions

12
.config/dotnet-tools.json Executable file
View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"versionize": {
"version": "1.15.2",
"commands": [
"versionize"
]
}
}
}

View File

@ -14,10 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
source-url: https://nuget.pkg.github.com/kyleratti/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dotnet-version: "6.0.x"
- name: Install dependencies
run: dotnet restore
- name: Build

47
.github/workflows/publish-release.yml vendored Executable file
View File

@ -0,0 +1,47 @@
name: "Publish Release"
on:
workflow_dispatch
# Allow one run of this workflow per branch and cancel existing runs if triggered again
concurrency:
group: fruityfoundation-publish-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write # Needed to push tags
jobs:
release:
runs-on: ubuntu-latest
environment: Publish
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0' # Load entire history
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'
- run: dotnet tool restore
- name: Generate Version
id: generate-version
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
dotnet tool run versionize
cd ./Base/
echo "RELEASE_VERSION_NUMBER=$(dotnet tool run versionize inspect)" >> $GITHUB_OUTPUT
git push --follow-tags
git fetch --tags origin
- run: dotnet restore
- run: dotnet build --no-restore -c Release -p:Version=${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}
- run: dotnet pack --no-build --no-restore --nologo --output=dist -c Release
- run: gh release create "v${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}" --notes-file CHANGELOG.md "dist/FruityFoundation.Base.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg" "dist/FruityFoundation.Db.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg" "dist/FruityFoundation.FsBase.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg"
env:
GH_TOKEN: ${{ github.token }}
- name: Publish to NuGet
run: |
cd ./dist/
dotnet nuget push "FruityFoundation.Base.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg" --api-key=${{ secrets.NUGET_API_KEY }} --source=https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push "FruityFoundation.FsBase.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg" --api-key=${{ secrets.NUGET_API_KEY }} --source=https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push "FruityFoundation.Db.${{ steps.generate-version.outputs.RELEASE_VERSION_NUMBER }}.nupkg" --api-key=${{ secrets.NUGET_API_KEY }} --source=https://api.nuget.org/v3/index.json --skip-duplicate

22
.versionize Executable file
View File

@ -0,0 +1,22 @@
{
"changelog": {
"header": "Changelog",
"sections": [
{
"type": "feat",
"section": "✨ Features",
"hidden": false
},
{
"type": "fix",
"section": "🐛 Bug Fixes",
"hidden": false
},
{
"type": "perf",
"section": "🚀 Performance",
"hidden": true
}
]
}
}

0
Base.Tests/Base.Tests.csproj Normal file → Executable file
View File

31
Base/Base.csproj Normal file → Executable file
View File

@ -1,17 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FruityFoundation.Base</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>FruityFoundation.Base</PackageId>
<Authors>Kyle Ratti</Authors>
<Company />
<Product>FruityFoundation.Base</Product>
<RepositoryUrl>https://github.com/kyleratti/FruityFoundation</RepositoryUrl>
<PackageVersion>1.1.1</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FruityFoundation.Base</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>FruityFoundation.Base</PackageId>
<Authors>Kyle Ratti</Authors>
<Company />
<Product>FruityFoundation.Base</Product>
<RepositoryUrl>https://github.com/kyleratti/FruityFoundation</RepositoryUrl>
<Version>1.1.2</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\LICENSE" Pack="true" PackagePath="" />
</ItemGroup>
</Project>

38
Db/Db.fsproj Normal file → Executable file
View File

@ -1,21 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>FruityFoundation.Db</RootNamespace>
<LangVersion>6.0</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>FruityFoundation.Db</PackageId>
<Authors>Kyle Ratti</Authors>
<Company />
<Product>FruityFoudnation.Db</Product>
<RepositoryUrl>https://github.com/kyleratti/FruityFoundation</RepositoryUrl>
<PackageVersion>1.0.5</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>FruityFoundation.Db</RootNamespace>
<LangVersion>6.0</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>FruityFoundation.Db</PackageId>
<Authors>Kyle Ratti</Authors>
<Company />
<Product>FruityFoudnation.Db</Product>
<RepositoryUrl>https://github.com/kyleratti/FruityFoundation</RepositoryUrl>
<Version>1.1.2</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Db.fs" />
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<Compile Include="Db.fs" />
</ItemGroup>
</Project>

7
FsBase/FsBase.fsproj Normal file → Executable file
View File

@ -7,8 +7,15 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>FruityFoundation.FsBase</PackageId>
<Authors>Kyle Ratti</Authors>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>1.1.2</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\LICENSE" Pack="true" PackagePath="" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Kyle
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.