From 7a4c9ffa585efc4500ce0658cafd3c714e56a3b4 Mon Sep 17 00:00:00 2001 From: Kyle Ratti Date: Wed, 30 Nov 2022 23:28:31 -0500 Subject: [PATCH] build: automatic versioning and publishing --- .config/dotnet-tools.json | 12 +++++++ .github/workflows/ci.yml | 5 +-- .github/workflows/publish-release.yml | 47 +++++++++++++++++++++++++++ .versionize | 22 +++++++++++++ Base.Tests/Base.Tests.csproj | 0 Base/Base.csproj | 31 ++++++++++-------- Db/Db.fsproj | 38 +++++++++++++--------- FsBase/FsBase.fsproj | 7 ++++ LICENSE | 21 ++++++++++++ 9 files changed, 150 insertions(+), 33 deletions(-) create mode 100755 .config/dotnet-tools.json create mode 100755 .github/workflows/publish-release.yml create mode 100755 .versionize mode change 100644 => 100755 Base.Tests/Base.Tests.csproj mode change 100644 => 100755 Base/Base.csproj mode change 100644 => 100755 Db/Db.fsproj mode change 100644 => 100755 FsBase/FsBase.fsproj create mode 100644 LICENSE diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100755 index 0000000..121cb7d --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "versionize": { + "version": "1.15.2", + "commands": [ + "versionize" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38dc244..88cc537 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100755 index 0000000..8ba9769 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -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 diff --git a/.versionize b/.versionize new file mode 100755 index 0000000..285fa09 --- /dev/null +++ b/.versionize @@ -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 + } + ] + } +} diff --git a/Base.Tests/Base.Tests.csproj b/Base.Tests/Base.Tests.csproj old mode 100644 new mode 100755 diff --git a/Base/Base.csproj b/Base/Base.csproj old mode 100644 new mode 100755 index b18def3..83a9041 --- a/Base/Base.csproj +++ b/Base/Base.csproj @@ -1,17 +1,22 @@ - - net6.0 - enable - enable - FruityFoundation.Base - true - FruityFoundation.Base - Kyle Ratti - - FruityFoundation.Base - https://github.com/kyleratti/FruityFoundation - 1.1.1 - + + net6.0 + enable + enable + FruityFoundation.Base + true + FruityFoundation.Base + Kyle Ratti + + FruityFoundation.Base + https://github.com/kyleratti/FruityFoundation + 1.1.2 + true + LICENSE + + + + diff --git a/Db/Db.fsproj b/Db/Db.fsproj old mode 100644 new mode 100755 index 4b34d54..a6b3caa --- a/Db/Db.fsproj +++ b/Db/Db.fsproj @@ -1,21 +1,27 @@  - - net6.0 - true - FruityFoundation.Db - 6.0 - true - FruityFoundation.Db - Kyle Ratti - - FruityFoudnation.Db - https://github.com/kyleratti/FruityFoundation - 1.0.5 - + + net6.0 + true + FruityFoundation.Db + 6.0 + true + FruityFoundation.Db + Kyle Ratti + + FruityFoudnation.Db + https://github.com/kyleratti/FruityFoundation + 1.1.2 + true + LICENSE + - - - + + + + + + + diff --git a/FsBase/FsBase.fsproj b/FsBase/FsBase.fsproj old mode 100644 new mode 100755 index a45672e..ce8d69d --- a/FsBase/FsBase.fsproj +++ b/FsBase/FsBase.fsproj @@ -7,8 +7,15 @@ true FruityFoundation.FsBase Kyle Ratti + true + 1.1.2 + LICENSE + + + + true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..08debbb --- /dev/null +++ b/LICENSE @@ -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.