From b142bf79411e240007cb7c56ab4c3ec4fc854ea1 Mon Sep 17 00:00:00 2001 From: Simon Novak Date: Fri, 14 Apr 2023 08:32:55 +0200 Subject: [PATCH 1/5] Remove GitVersion.MsBuild, use GitHub Action instead --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++++++++++- Directory.Packages.props | 9 -------- 2 files changed, 42 insertions(+), 10 deletions(-) delete mode 100644 Directory.Packages.props diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e639e46..c5d3cdd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,14 +12,55 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + preferLatestVersion: true - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet-version }} - name: Restore .NET Packages run: dotnet restore + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + with: + useConfigFile: true + - 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 "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 "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" - name: Build .NET Solution - run: dotnet build --configuration Release --no-restore + run: dotnet build --configuration Release --no-restore /p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} - name: Pack .NET Solution run: dotnet pack --no-build --output pack/ - name: Publish .NET Solution to GitHub Packages diff --git a/Directory.Packages.props b/Directory.Packages.props deleted file mode 100644 index ec5f599..0000000 --- a/Directory.Packages.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - From 2a37c833e0111d7fd03cc1dfcc17d3fd6416cb97 Mon Sep 17 00:00:00 2001 From: Simon Novak Date: Fri, 14 Apr 2023 09:19:56 +0200 Subject: [PATCH 2/5] Revert back to GitVersion.MsBuild --- .github/workflows/build.yml | 33 +-------------------------------- Directory.Packages.props | 9 +++++++++ 2 files changed, 10 insertions(+), 32 deletions(-) create mode 100644 Directory.Packages.props diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5d3cdd..b3b17cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,39 +28,8 @@ jobs: uses: gittools/actions/gitversion/execute@v0 with: useConfigFile: true - - 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 "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 "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" - name: Build .NET Solution - run: dotnet build --configuration Release --no-restore /p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} + run: dotnet build --configuration Release --no-restore - name: Pack .NET Solution run: dotnet pack --no-build --output pack/ - name: Publish .NET Solution to GitHub Packages diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..ec5f599 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,9 @@ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + From 57c28ea5843e1e7e7175c4d4a7df6801466caf91 Mon Sep 17 00:00:00 2001 From: Simon Novak Date: Fri, 14 Apr 2023 09:26:26 +0200 Subject: [PATCH 3/5] Git Checkout on HEAD^ --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3b17cd..315e88c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' + - run: git checkout HEAD^ - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0 with: From deabc541b1b5247364eeed5f9ee2de79b00e3030 Mon Sep 17 00:00:00 2001 From: Simon Novak Date: Fri, 14 Apr 2023 09:31:19 +0200 Subject: [PATCH 4/5] Git Checkout on main, nuget push --skip-duplicate --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 315e88c..7432af3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' - - run: git checkout HEAD^ + - run: git checkout main - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0 with: @@ -35,9 +35,9 @@ jobs: run: dotnet pack --no-build --output pack/ - name: Publish .NET Solution to GitHub Packages continue-on-error: true - run: dotnet nuget push pack/* --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + run: dotnet nuget push pack/* --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" - name: Publish .NET Solution to NuGet.org continue-on-error: true - run: dotnet nuget push pack/* --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget + run: dotnet nuget push pack/* --skip-duplicate --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget From 779a29fb6bdc20dcec5f71f43c71b9c6b48d1139 Mon Sep 17 00:00:00 2001 From: Simon Novak Date: Fri, 14 Apr 2023 09:44:55 +0200 Subject: [PATCH 5/5] Switch to Continuous Delivery --- .github/workflows/build.yml | 11 ----------- GitVersion.yml | 2 -- 2 files changed, 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7432af3..b89fcab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,23 +12,12 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' - - run: git checkout main - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0 - with: - versionSpec: '5.x' - preferLatestVersion: true - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet-version }} - name: Restore .NET Packages run: dotnet restore - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v0 - with: - useConfigFile: true - name: Build .NET Solution run: dotnet build --configuration Release --no-restore - name: Pack .NET Solution diff --git a/GitVersion.yml b/GitVersion.yml index 20bb439..11d7b91 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,3 @@ -mode: Mainline branches: master: - increment: None tag: rc