Skip to content

Commit

Permalink
Publish daily to Nuget (#2077)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ authored Jan 10, 2024
1 parent 9286cb2 commit 8edf8a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 34 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/cli-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,14 @@ jobs:
- uses: actions/checkout@v4

- name: Package CLI 6
run: dotnet pack src\GUI\efcpt.6\efcpt.6.csproj -p:PackageVersion=6.1.${{ env.VERSION }} -p:InformationalVersion=6.1.${{ env.VERSION }}
run: dotnet pack src\GUI\efcpt.6\efcpt.6.csproj -p:PackageVersion=6.1.${{ env.VERSION }}-nightly -p:InformationalVersion=6.1.${{ env.VERSION }}-nightly

- name: Package CLI 7
run: dotnet pack src\GUI\efcpt.7\efcpt.7.csproj -p:PackageVersion=7.1.${{ env.VERSION }} -p:InformationalVersion=7.1.${{ env.VERSION }}
run: dotnet pack src\GUI\efcpt.7\efcpt.7.csproj -p:PackageVersion=7.1.${{ env.VERSION }}-nightly -p:InformationalVersion=7.1.${{ env.VERSION }}-nightly

- name: Package CLI 8
run: dotnet pack src\GUI\efcpt.8\efcpt.8.csproj -p:PackageVersion=8.1.${{ env.VERSION }} -p:InformationalVersion=8.1.${{ env.VERSION }}

- name: Package Dacpac 6
run: dotnet pack src\GUI\ErikEJ.EntityFrameworkCore.SqlServer.Dacpac\ErikEJ.EntityFrameworkCore.6.SqlServer.Dacpac.csproj

- name: Package Dacpac 7
run: dotnet pack src\GUI\ErikEJ.EntityFrameworkCore.7.SqlServer.Dacpac\ErikEJ.EntityFrameworkCore.7.SqlServer.Dacpac.csproj

- name: Package Dacpac 8
run: dotnet pack src\GUI\ErikEJ.EntityFrameworkCore.8.SqlServer.Dacpac\ErikEJ.EntityFrameworkCore.8.SqlServer.Dacpac.csproj

- name: Package SqlQuery 6
run: dotnet pack src\GUI\ErikEJ.EntityFrameworkCore.6.SqlServer.SqlQuery\ErikEJ.EntityFrameworkCore.6.SqlServer.SqlQuery.csproj

- name: Package SqlQuery 7
run: dotnet pack src\GUI\ErikEJ.EntityFrameworkCore.7.SqlServer.SqlQuery\ErikEJ.EntityFrameworkCore.7.SqlServer.SqlQuery.csproj

run: dotnet pack src\GUI\efcpt.8\efcpt.8.csproj -p:PackageVersion=8.1.${{ env.VERSION }}-nightly -p:InformationalVersion=8.1.${{ env.VERSION }}-nightly

- name: Core test project
run: dotnet test src\GUI\NUnitTestCore\NUnitTestCore.csproj
continue-on-error: false
Expand All @@ -54,11 +39,7 @@ jobs:
path: |
**/*.nupkg
- name: Set NuGet source
if: startsWith(github.ref, 'refs/heads/master')
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ErikEJ/index.json"

- name: Publish NuGet
if: startsWith(github.ref, 'refs/heads/master')
run: dotnet nuget push **\*.nupkg --source https://ci.appveyor.com/nuget/erikej/api/v2/package --api-key ${{ secrets.APPVEYOR_NUGET_TOKEN }} --skip-duplicate

run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{ secrets.NUGET }} --skip-duplicate
10 changes: 6 additions & 4 deletions src/GUI/efcpt.7/Services/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ public static async Task CheckForPackageUpdateAsync()

using var cache = new SourceCacheContext();
var repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json");
var resource = await repository.GetResourceAsync<FindPackageByIdResource>().ConfigureAwait(false);
var resource = await repository.GetResourceAsync<PackageMetadataResource>().ConfigureAwait(false);

var versions = await resource.GetAllVersionsAsync(
var packages = await resource.GetMetadataAsync(
"ErikEJ.EFCorePowerTools.Cli",
includePrerelease: false,
includeUnlisted: false,
cache,
logger,
cancellationToken).ConfigureAwait(false);

var latestVersion = versions.Where(v => v.Major == Constants.Version).MaxBy(v => v);
var latestVersion = packages.Where(v => v.Identity.Version.Major == Constants.Version).Select(v => v.Identity.Version).MaxBy(v => v);
if (latestVersion > CurrentPackageVersion())
{
DisplayService.MarkupLine("Your are not using the latest version of the tool, please update to get the latest bug fixes, features and support", Color.Yellow);
DisplayService.MarkupLine($"Latest version is '{latestVersion}'", Color.Yellow);
DisplayService.MarkupLine($"Run 'dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version {Constants.Version}.0.*-*' to get the latest version.", Color.Yellow);
DisplayService.MarkupLine($"Run 'dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version {Constants.Version}.0.*' to get the latest version.", Color.Yellow);
}
}
#pragma warning disable CA1031
Expand Down
10 changes: 5 additions & 5 deletions src/GUI/efcpt.7/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ For a quick intro you can watch [this 2 minute demo video](https://www.youtube.c
EF Core 8:

```bash
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*-*
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*
```

EF Core 7:

```bash
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 7.0.*-*
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 7.0.*
```

EF Core 6:

```bash
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 6.0.*-*
dotnet tool install ErikEJ.EFCorePowerTools.Cli -g --version 6.0.*
```

### Running the tool
Expand Down Expand Up @@ -112,13 +112,13 @@ The tool can generate a [Mermaid ER diagram](https://mermaid.js.org/syntax/entit
### Updating the tool

```bash
dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*-*
dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*
```

[Release notes](https://github.com/ErikEJ/EFCorePowerTools/wiki/Release-notes) - notice the `+CLI` label.

### Getting the latest daily build

```bash
dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*-* --add-source https://ci.appveyor.com/nuget/efcorepowertools
dotnet tool update ErikEJ.EFCorePowerTools.Cli -g --version 8.0.*-*
```

0 comments on commit 8edf8a9

Please sign in to comment.