From f96f07d8b0b28a762ae85d45756b308cf2492154 Mon Sep 17 00:00:00 2001 From: Artemy Gordon Date: Wed, 30 Oct 2024 14:37:03 +0200 Subject: [PATCH 1/5] TRD-5651, update libs: Updated 'EntityFrameworkCore' --- MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj b/MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj index 5473bfd..8007172 100644 --- a/MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj +++ b/MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj @@ -7,12 +7,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 9dc2fa281127f3916b051eabe4036ba21828ebb7 Mon Sep 17 00:00:00 2001 From: Artemy Gordon Date: Wed, 30 Oct 2024 15:16:39 +0200 Subject: [PATCH 2/5] TRD-5651, update libs: Added github workflow --- .github/workflows/build-client-pkg.yaml | 116 ++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/build-client-pkg.yaml diff --git a/.github/workflows/build-client-pkg.yaml b/.github/workflows/build-client-pkg.yaml new file mode 100644 index 0000000..de1d042 --- /dev/null +++ b/.github/workflows/build-client-pkg.yaml @@ -0,0 +1,116 @@ +name: Release client library + +on: + push: + branches: + - "**" + +env: + DOTNET_ROLL_FORWARD: Major + CLIENT_PROJ: MyJetTools.Sdk.EfPostgres + GIT_VERSION_CONFIG: ./build/GitVersion.yml + +jobs: + + calculate_version: + runs-on: ubuntu-latest + outputs: + assemblyVersion: ${{ steps.gitversion.outputs.assemblySemVer }} + fileVersion: ${{ steps.gitversion.outputs.assemblySemFileVer }} + infoVersion: ${{ steps.gitversion.outputs.informationalVersion }} + pkgVersion: ${{ steps.pkg_calc.outputs.nugetPkgVersion }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: '5.x' + + - name: Calculate Total Commits + run: | + echo "TOTAL_COMMITS=$(git rev-list HEAD --count)" >> $GITHUB_ENV + echo "Total commits since start of the repo $TOTAL_COMMITS" + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + configFilePath: ${{ env.GIT_VERSION_CONFIG }} + + - name: Calculate Package Version + id: pkg_calc + run: | + if [[ "${{ steps.gitversion.outputs.preReleaseLabel }}" == "" ]]; then + echo "nugetPkgVersion=${{ steps.gitversion.outputs.assemblySemFileVer }}" >> $GITHUB_OUTPUT + else + echo "nugetPkgVersion=${{ steps.gitversion.outputs.assemblySemFileVer }}${{ steps.gitversion.outputs.PreReleaseLabelWithDash }}${{ github.run_number }}" >> $GITHUB_OUTPUT + fi + - name: Print Versions + run: | + echo "Assembly version: ${{ steps.gitversion.outputs.assemblySemVer }}" + echo "File version: ${{ steps.gitversion.outputs.assemblySemFileVer }}" + echo "Info version: ${{ steps.gitversion.outputs.informationalVersion }}" + echo "NuGet package version: ${{ steps.pkg_calc.outputs.nugetPkgVersion }}" + create_artifacts: + runs-on: ubuntu-latest + needs: calculate_version + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Update NuGet sources + run: dotnet nuget add source https://nuget.pkg.github.com/youtoken/index.json -n YouHodlerGitHub -u user -p ${{secrets.NUGET_GITHUB_TOKEN}} --store-password-in-clear-text + + - name: Build + run: | + dotnet build --configuration Release /p:AssemblyVersion=${{ needs.calculate_version.outputs.assemblyVersion }} /p:FileVersion=${{ needs.calculate_version.outputs.fileVersion }} /p:InformationalVersion=${{ needs.calculate_version.outputs.infoVersion }} + - name: Test + run: dotnet test --no-build --configuration Release + + - name: Library Packaging + run: | + echo "Create package ${{ env.CLIENT_PROJ }} with version ${{ needs.calculate_version.outputs.pkgVersion }}" + dotnet pack --configuration Release ${{ env.CLIENT_PROJ }} /p:PackageVersion=${{ needs.calculate_version.outputs.pkgVersion }} + - name: Upload package to artifacts + uses: actions/upload-artifact@v3 + with: + name: package + path: ${{ env.CLIENT_PROJ }}/bin/Release/*.nupkg + + upload-to-nuget: + needs: create_artifacts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Download built library + uses: actions/download-artifact@v3 + with: + name: package + path: Package + + - name: List Of Packages + run: ls -la + + - name: Publish the package to GitHub + uses: tanaka-takayoshi/nuget-publish-to-github-packages-action@v2.1 + with: + nupkg-path: "./Package/*.nupkg" + repo-owner: 'YouToken' + gh-user: ${{ github.actor }} + token: ${{ secrets.NUGET_GITHUB_TOKEN }} \ No newline at end of file From f6b40e47439b665fdd3557ddc5497dc6edd813bd Mon Sep 17 00:00:00 2001 From: Artemy Gordon Date: Wed, 30 Oct 2024 15:22:56 +0200 Subject: [PATCH 3/5] TRD-5651, update libs: Added build version script --- build/GitVersion.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 build/GitVersion.yml diff --git a/build/GitVersion.yml b/build/GitVersion.yml new file mode 100644 index 0000000..92b6473 --- /dev/null +++ b/build/GitVersion.yml @@ -0,0 +1,33 @@ +assembly-versioning-format: '{Major}.{Minor}.{Patch}' +assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:TOTAL_COMMITS ?? 0}' +assembly-informational-format: '{Major}.{Minor}.{Patch}.{env:TOTAL_COMMITS ?? 0}+{ShortSha}_BRANCH.{BranchName}' +branches: + release: + tag: beta + is-release-branch: true + # for RC branches : releases/v[number] + # the same as default config + # in the command line write : dotnet gitversion /showconfig + + feature: + tag: useBranchName + increment: None + mode: ContinuousDelivery + regex: ^features?[/-] + pre-release-weight: 30000 + + test: + tag: useBranchName + increment: None + mode: ContinuousDelivery + regex: ^tests?[/-] + source-branches: ['main'] + pre-release-weight: 30000 + + main: + regex: ^main$ + increment: None + +ignore: + sha: [] +merge-message-formats: {} \ No newline at end of file From 4fe972f5a5b2e78eed6c32bd411a4906f88df867 Mon Sep 17 00:00:00 2001 From: Artemy Gordon Date: Wed, 30 Oct 2024 15:58:24 +0200 Subject: [PATCH 4/5] TRD-5651, update libs: Removed unnecessary script --- .github/workflows/release.yaml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index d2a2965..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Release nuget - -on: - release: - types: [ published ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.* - - name: Build - run: dotnet build --configuration Release - - name: Test - run: dotnet test --configuration Release - - - name: Create the package - MyJetTools.Sdk.EfPostgres - run: dotnet pack --configuration Release MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj /p:Version=${GITHUB_REF#refs/tags/} - - - name: Publish the package - run: dotnet nuget push MyJetTools.Sdk.EfPostgres/bin/Release/*.nupkg -s "https://api.nuget.org/v3/index.json" -k ${{ secrets.NUGET_TOCKEN }} \ No newline at end of file From 888121e7d178a1a2028c99fb8d11bdbbdf5d389f Mon Sep 17 00:00:00 2001 From: Artemy Gordon Date: Wed, 30 Oct 2024 17:43:08 +0200 Subject: [PATCH 5/5] TRD-5651, update libs: Tried to fix publish to nuget --- .github/workflows/build-client-pkg.yaml | 7 ++- .github/workflows/release.yaml | 78 +++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build-client-pkg.yaml b/.github/workflows/build-client-pkg.yaml index de1d042..8947491 100644 --- a/.github/workflows/build-client-pkg.yaml +++ b/.github/workflows/build-client-pkg.yaml @@ -1,9 +1,10 @@ -name: Release client library +name: Release sdk client library on: push: - branches: - - "**" + branches-ignore: + - "main" + - "master" env: DOTNET_ROLL_FORWARD: Major diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..2bb683e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,78 @@ +name: Release sdk client library + +on: + push: + tags: + - "*.*.*" + +jobs: + test-and-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.* + + - name: Update NuGet sources + run: dotnet nuget add source https://nuget.pkg.github.com/youtoken/index.json -n YouHodlerGitHub -u user -p ${{secrets.NUGET_GITHUB_TOKEN}} --store-password-in-clear-text + + - name: Library Test + run: dotnet test --no-build --configuration Release + + - name: Calculate VERSION + id: calculate-version + run: | + echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + echo "MAJOR_MINOR_PATCH=$(echo ${GITHUB_REF#refs/tags/} | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT + + - name: Library Build + run: | + echo "Calculated VERSION: ${{ steps.calculate-version.outputs.MAJOR_MINOR_PATCH }}" + dotnet build --configuration Release /p:AssemblyVersion=${{ steps.calculate-version.outputs.MAJOR_MINOR_PATCH }} + + - name: Library wrap + run: | + echo "Package VERSION: ${{ steps.calculate-version.outputs.TAG }}" + dotnet pack --configuration Release MyJetTools.Sdk.EfPostgres /p:PackageVersion=${{ steps.calculate-version.outputs.TAG }} + + - name: Upload package to artifacts + uses: actions/upload-artifact@v3 + with: + name: package + path: MyServiceBus.Sdk/bin/Release/*.nupkg + + upload-to-github-nuget: + needs: test-and-build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + source-url: https://nuget.pkg.github.com/youtoken/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Download builded library + uses: actions/download-artifact@v3 + with: + name: package + path: Package + + - name: ls + run: ls -la + + - name: Publish the package to GitHub + uses: tanaka-takayoshi/nuget-publish-to-github-packages-action@v2.1 + with: + nupkg-path: "./Package/*.nupkg" + repo-owner: 'YouToken' + gh-user: ${{ github.actor }} + token: ${{ secrets.NUGET_GITHUB_TOKEN }} \ No newline at end of file