diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 60d6f87..0cfdaaf 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -12,15 +12,72 @@ jobs: dotnet-version: ['6.0.x'] steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install GitVersion # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/setup/usage-examples.md + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + + - name: Determine Version + id: gitversion # id to later be referenced + uses: gittools/actions/gitversion/execute@v0 + with: + useConfigFile: true + additionalArguments: '/updateprojectfiles' + + - name: Display GitVersion outputs (step output) + run: | + echo "Major: ${{ steps.gitversion.outputs.major }}" + echo "Minor: ${{ steps.gitversion.outputs.minor }}" + echo "Patch: ${{ steps.gitversion.outputs.patch }}" + echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}" + echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}" + echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}" + echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}" + echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}" + echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}" + echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}" + echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}" + echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" + echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" + echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}" + echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}" + echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}" + echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}" + echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" + echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}" + echo "BranchName: ${{ steps.gitversion.outputs.branchName }}" + echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}" + echo "Sha: ${{ steps.gitversion.outputs.sha }}" + echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}" + echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}" + echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}" + echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}" + echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}" + echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}" + echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}" + echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}" + echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}" + echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" + - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet-version }} - + additionalArguments: '/showConfig' + - name: Build run: dotnet build ./src/Nox.Types --warnaserror --configuration Release - - name: Pack Nox.Types - run: dotnet pack --no-build ./src/Nox.Types --configuration Release -o ./artifacts + - name: Pack Nox.Types + run: dotnet pack --no-build ./src/Nox.Types --configuration Release -o ./artifacts + - name: Publish Nox.Lib + if: github.ref == 'refs/heads/main' run: dotnet nuget push ./artifacts/Nox.Types.*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + + - name: Publish Nox.Lib Warning + if: github.ref != 'refs/heads/main' + run: echo "Skipping publishing, not in main branch" \ No newline at end of file diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..ed16160 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,5 @@ +mode: ContinuousDelivery +branches: {} +ignore: + sha: [] +merge-message-formats: {} diff --git a/README.md b/README.md index 9742356..c1ab9c8 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,21 @@ public string ToString(IFormatProvider formatProvider) return $"{Value.Latitude.ToString(formatProvider)} {Value.Longitude.ToString(formatProvider)}"; } ``` + +## Versioning + +We are using [SemVer](https://semver.org/) for versioning our deliverables. + +To manage this version we are using [GitVersion](https://github.com/GitTools/GitVersion) tool. + +### Using it locally + +You can use gitversion locally to test and setup configuration. To do that intall the dotnet tool `dotnet tool install --global GitVersion.Tool --version 5.*` + +run `dotnet-gitversion` to see the current variables of git version + +run `dotnet-gitversion /updateprojectfiles` to update csproject files + +## Release + +Just Create a release in GitHub, tag it properly, and that is all. In the future we want to automate this process. diff --git a/src/Nox.Types.sln b/src/Nox.Types.sln index b2f9230..9e0ec81 100644 --- a/src/Nox.Types.sln +++ b/src/Nox.Types.sln @@ -11,6 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nox.Types.EntityFramework", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{4E819E2B-6E88-47DA-AA56-1194B9921B31}" ProjectSection(SolutionItems) = preProject + ..\GitVersion.yml = ..\GitVersion.yml ..\README.md = ..\README.md EndProjectSection EndProject diff --git a/src/Nox.Types/Nox.Types.csproj b/src/Nox.Types/Nox.Types.csproj index 1075134..1d7eade 100644 --- a/src/Nox.Types/Nox.Types.csproj +++ b/src/Nox.Types/Nox.Types.csproj @@ -13,10 +13,7 @@ false Copyright (c) Andre Sharpe 2022 true - 1.0.8.0 - 1.0.8.0 - 1.0.8 - MIT + MIT https://github.com/NoxOrg/Nox https://github.com/NoxOrg/Nox.Types.git git @@ -25,4 +22,4 @@ - + \ No newline at end of file