Skip to content

Commit 59256ad

Browse files
committed
Update dotnet-publish.yml
1 parent a6c7b95 commit 59256ad

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

.github/workflows/dotnet-publish.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2-
32
name: publish
43
on:
54
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
@@ -12,49 +11,45 @@ on:
1211
release:
1312
types:
1413
- published # Run the workflow when a new GitHub release is published
15-
1614
env:
1715
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
1816
DOTNET_NOLOGO: true
1917
NuGetDirectory: ${{ github.workspace}}/nuget
20-
2118
defaults:
2219
run:
2320
shell: pwsh
24-
2521
jobs:
2622
build_and_pack:
27-
name: Build & Pack
23+
name: Build & Test & Pack
2824
runs-on: ubuntu-latest # Use Linux runner
29-
3025
permissions:
3126
contents: write # Needed for gh release create step to upload assets
32-
3327
steps:
3428
- name: Checkout code
3529
uses: actions/checkout@v4
3630
with:
3731
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
38-
3932
- name: Setup .NET 9 SDK
4033
uses: actions/setup-dotnet@v4
4134
with:
4235
dotnet-version: '9.x' # Use the .NET 9 SDK
43-
4436
- name: Restore dependencies
4537
run: dotnet restore TTSTextNormalization.sln # Restore for the whole solution
46-
4738
- name: Build Library
4839
# Build the specific library project in Release config
49-
# Override the Version using the extracted tag version
5040
run: dotnet build TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-restore
51-
41+
42+
# --- New Test Step ---
43+
- name: Run Unit Tests
44+
# Run tests for the entire solution in Release config
45+
# --no-build assumes the previous build step was successful
46+
run: dotnet test TTSTextNormalization.sln --configuration Release --no-build --verbosity normal
47+
5248
- name: Pack Library
5349
# Pack the specific library project
54-
# Use the extracted tag version again
50+
# Use Release config
5551
# Output packages to an 'artifacts' directory
5652
run: dotnet pack TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-build --output ${{ env.NuGetDirectory }}
57-
5853
- uses: actions/upload-artifact@v4
5954
with:
6055
name: nuget
@@ -68,18 +63,16 @@ jobs:
6863
# You can update this logic if you want to manage releases differently
6964
if: github.event_name == 'release'
7065
runs-on: ubuntu-latest
71-
needs: [build_and_pack]
66+
needs: [build_and_pack] # Depends on the job that now includes testing
7267
steps:
7368
# Download the NuGet package created in the previous job
7469
- uses: actions/download-artifact@v4
7570
with:
7671
name: nuget
7772
path: ${{ env.NuGetDirectory }}
78-
7973
# Install the .NET SDK indicated in the global.json file
8074
- name: Setup .NET Core
8175
uses: actions/setup-dotnet@v4
82-
8376
# Publish all NuGet packages to NuGet.org
8477
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
8578
# If you retry a failed workflow, already published packages will be skipped without error.

0 commit comments

Comments
 (0)