Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/build-client-pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Release sdk client library

on:
push:
branches-ignore:
- "main"
- "master"

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 }}
79 changes: 66 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,78 @@
name: Release nuget
name: Release sdk client library

on:
release:
types: [ published ]
push:
tags:
- "*.*.*"

jobs:
build:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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: 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: 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: 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 }}
- 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 }}
4 changes: 2 additions & 2 deletions MyJetTools.Sdk.EfPostgres/MyJetTools.Sdk.EfPostgres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MyJetTools.Telemetry" Version="1.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.1" />
</ItemGroup>

</Project>
33 changes: 33 additions & 0 deletions build/GitVersion.yml
Original file line number Diff line number Diff line change
@@ -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: {}
Loading