Skip to content

Commit

Permalink
feat: add nuget feed as part of the solution (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
anddrzejb authored Apr 14, 2024
1 parent 7fdf054 commit 54bcb32
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 92 deletions.
23 changes: 23 additions & 0 deletions .github/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Add Evolutionary Architecture Nuget Source
description: Remove a default Evolutionary Architecture nuget source and add with credentials
inputs:
github-token:
description: GitHub token
required: true
owner:
description: Repository owner
required: true
path:
description: "Path to the directory"
required: true
runs:
using: "composite"
steps:
- name: Add Authorized Evolutionary Architecture Nuget Source
run: |
cd ${{ github.workspace }}/${{ inputs.path }}
NugetSourceName="evolutionaryArchitecture"
dotnet nuget remove source $NugetSourceName
dotnet nuget add source --username ${{ inputs.owner }} --password ${{ inputs.github-token }} --store-password-in-clear-text --name $NugetSourceName "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget list source
shell: bash
44 changes: 21 additions & 23 deletions .github/workflows/chapter-3-contracts-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
name: Chapter 3 Contracts
on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-3-microservice-extraction/Fitnet.Contracts/Src/**'
- "Chapter-3-microservice-extraction/Fitnet.Contracts/Src/**"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-3-microservice-extraction/Fitnet.Contracts/Src/**'
- "Chapter-3-microservice-extraction/Fitnet.Contracts/Src/**"

env:
CHAPTER_DIR: 'Chapter-3-microservice-extraction/Fitnet.Contracts/Src'
CHAPTER_DIR: "Chapter-3-microservice-extraction/Fitnet.Contracts/Src"

jobs:
jobs:
build:
defaults:
run:
working-directory: ${{ env.CHAPTER_DIR }}
runs-on: ubuntu-latest

name: Build
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore

test:
defaults:
run:
Expand All @@ -51,14 +50,13 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Test
run: dotnet test
run: dotnet test
36 changes: 17 additions & 19 deletions .github/workflows/chapter-3-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Chapter 3 Modular Monolith workflow

on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-3-microservice-extraction/Fitnet/Src/**'
- "Chapter-3-microservice-extraction/Fitnet/Src/**"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-3-microservice-extraction/Fitnet/Src/**'
- "Chapter-3-microservice-extraction/Fitnet/Src/**"

env:
CHAPTER_DIR: 'Chapter-3-microservice-extraction/Fitnet/Src'
CHAPTER_DIR: "Chapter-3-microservice-extraction/Fitnet/Src"

jobs:
build:
Expand All @@ -27,13 +27,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -52,13 +51,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Test
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/chapter-4-contracts-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Chapter 4 Contracts
on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/**'
- "Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/**"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/**'
- "Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/**"

env:
CHAPTER_DIR: 'Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src'
CHAPTER_DIR: "Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src"

jobs:
build:
Expand All @@ -26,13 +26,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -51,13 +50,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Test
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/chapter-4-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Chapter 4 Modular Monolith workflow

on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src/**'
- "Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src/**"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- 'Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src/**'
- "Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src/**"

env:
CHAPTER_DIR: 'Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src'
CHAPTER_DIR: "Chapter-4-applying-tactical-domain-driven-design/Fitnet/Src"

jobs:
build:
Expand All @@ -27,13 +27,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -52,13 +51,12 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add GitHub NuGet Source
run: |
dotnet nuget add source --username $OWNER --password $GITHUB_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/$OWNER/index.json"
dotnet nuget list source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@feature/nuget_config
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
- name: Restore dependencies
run: dotnet restore
- name: Test
Expand Down
Binary file added Assets/nuget-feed-credentials-vs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/nuget_feed_credentials_rider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="evolutionaryArchitecture" value="https://nuget.pkg.github.com/evolutionary-architecture/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
17 changes: 17 additions & 0 deletions Chapter-3-microservice-extraction/Fitnet/Src/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="evolutionaryArchitecture" value="https://nuget.pkg.github.com/evolutionary-architecture/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
37 changes: 31 additions & 6 deletions Chapter-3-microservice-extraction/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,38 @@ That's it! You should now be able to run the application using either one of the

=== Building and debugging code in Rider IDE

Before you build or debug code in `Rider` environment, you first have to configure artifactory to allow to download packages for `Common` which is a part of this repository:
Before you build or debug code in `Rider` or `Visual Studio` IDE, you first have to provide your user name and previously generated PAT for artifactory to download packages for `Common` which is a part of this repository. When you load the solution, your IDE should request the credentials:

- 1. Open `JetBrains Rider` and navigate to `File > Settings > NuGet > Sources`.
- 2. Click the `+` button to add a new package source.
- 3. In the `Add Package Source` window, provide Artifactory URL in the `https://nuget.pkg.github.com/evolutionary-architecture/index.json`, fill your Github Username and PAT.
- 4. Click `OK` to confirm the new package source.
- 5. Make sure your new package source is enabled and then click `OK` to close the `Settings` window.
- Rider:
++++
<div>
<img src="../Assets/nuget_feed_credentials_rider.png" width="464" align="center" height="195" alt="rider nuget feed credentials request">
</div>
++++
- Visual Studio:
++++
<div>
<img src="../Assets/nuget-feed-credentials-vs.png" width="322" align="center" height="289" alt="vs nuget feed credentials request">
</div>
++++

In case of any issues, you can add nuget feed manually:

- `Rider`
1. Open `JetBrains Rider`, right click on the solution in the solution explorer and click `Manage NuGet Packages`.
1. Click on the `Sources` tab.
1. Click the `+` button to add a new package source.
1. In the `Add Package Source` window, provide Artifactory URL in the `https://nuget.pkg.github.com/evolutionary-architecture/index.json`, fill your Github Username and PAT.
1. Click `OK` to confirm the new package source.
1. Make sure your new package source is enabled and then click `OK` to close the `Settings` window.
1. You sould be promted for user name and password (PAT).
- `Visual Studio`
1. Open `Microsoft Visual Studio`, right click on the solution in the solution explorer and click `Manage NuGet Packages for Solution`.
1. Click on the `gears` icon.
1. Click the `+` button to add a new package source.
1. Set the package name and se the source to Artifactory URL `https://nuget.pkg.github.com/evolutionary-architecture/index.json`.
1. You sould be promted for user name and password (PAT).
1. Click `OK` to confirm the new package source.

You should now be able to restore and download the EvolutionaryArchitecture nuget packages from your Artifactory source within Rider.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="evolutionaryArchitecture" value="https://nuget.pkg.github.com/evolutionary-architecture/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
Loading

0 comments on commit 54bcb32

Please sign in to comment.