Skip to content

Commit 63ee5c1

Browse files
authored
updates to use reusable workflows (#126)
1 parent 1f2e6bd commit 63ee5c1

File tree

3 files changed

+20
-114
lines changed

3 files changed

+20
-114
lines changed

.github/workflows/Integration.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,9 @@ on:
44
pull_request:
55
branches: [ main ]
66

7-
env:
8-
dotnet-version: '9.0.x'
9-
107
jobs:
118
CI:
12-
runs-on: windows-latest
13-
env:
9+
uses: HydrologicEngineeringCenter/dotnet-workflows/.github/workflows/integration.yml@main
10+
with:
1411
dotnet-version: '9.0.x'
15-
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
22-
- name: Setup .NET Core SDK ${{ env.dotnet-version }}
23-
uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: ${{ env.dotnet-version }}
26-
27-
- name: Test Solution
28-
run: dotnet test --nologo -c Release
12+
run-tests: true

.github/workflows/Release.yml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Snapshot
1+
name: Release
22

33
on:
44
push:
@@ -7,39 +7,11 @@ on:
77

88
jobs:
99
build:
10-
runs-on: windows-latest
11-
12-
env:
13-
dotnet-version: '9.0.x'
14-
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
with:
19-
fetch-depth: 0
20-
21-
- name: Setup .NET Core SDK ${{ env.dotnet-version }}
22-
uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: ${{ env.dotnet-version }}
25-
26-
- name: Test
27-
run: dotnet test -c Release
28-
29-
- name: Create version number
30-
shell: pwsh
31-
run: |
32-
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
33-
$VERSION = $TAG -replace '^v', ''
34-
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
35-
36-
- name: Pack
37-
shell: pwsh
38-
run: |
39-
# Use the snapshot version from the previous step
40-
dotnet pack --configuration Release /p:PackageVersion=${{ env.VERSION }}
41-
42-
- name: Publish
43-
shell: pwsh
44-
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NEXUS_NUGET_APIKEY }} --source "https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/" --skip-duplicate
45-
10+
uses: HydrologicEngineeringCenter/dotnet-workflows/.github/workflows/release.yml@main
11+
with:
12+
dotnet-version: '9.0.x'
13+
project-names: 'Numerics'
14+
run-tests: true
15+
nuget-source: 'https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/'
16+
secrets:
17+
NUGET_API_KEY: ${{ secrets.NEXUS_NUGET_APIKEY }}

.github/workflows/Snapshot.yml

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,11 @@ on:
66

77
jobs:
88
build:
9-
runs-on: windows-latest
10-
11-
env:
12-
dotnet-version: '9.0.x'
13-
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
with:
18-
fetch-depth: 0
19-
20-
- name: Setup .NET Core SDK ${{ env.dotnet-version }}
21-
uses: actions/setup-dotnet@v4
22-
with:
23-
dotnet-version: ${{ env.dotnet-version }}
24-
25-
- name: Test
26-
run: dotnet test -c Release
27-
28-
- name: Get version from built assembly and set snapshot version
29-
id: set-version
30-
shell: powershell
31-
run: |
32-
# Get the assembly version from the built DLL. It's already built from the test step.
33-
$assemblyPath = "Numerics/bin/Release/net8.0/Numerics.dll"
34-
35-
# Load the assembly and get its version
36-
$assembly = [System.Reflection.Assembly]::LoadFrom((Resolve-Path $assemblyPath).Path)
37-
$assemblyVersion = $assembly.GetName().Version
38-
39-
# Extract major.minor.patch from assembly version
40-
$baseVersion = "$($assemblyVersion.Major).$($assemblyVersion.Minor).$($assemblyVersion.Build)"
41-
42-
# Create snapshot version with GitHub run number
43-
$snapshotVersion = "${baseVersion}.${{ github.run_number }}-dev"
44-
45-
# Output the version for use in next steps
46-
echo "SNAPSHOT_VERSION=$snapshotVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
47-
echo "BASE_VERSION=$baseVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
48-
49-
# Also set as step output
50-
echo "version=$snapshotVersion" >> $env:GITHUB_OUTPUT
51-
echo "base_version=$baseVersion" >> $env:GITHUB_OUTPUT
52-
53-
# Display the version
54-
Write-Host "Assembly Version: $assemblyVersion"
55-
Write-Host "Base Version: $baseVersion"
56-
Write-Host "Snapshot Version: $snapshotVersion"
57-
58-
- name: Pack
59-
run: |
60-
# Use the snapshot version from the previous step
61-
dotnet pack --configuration Release /p:PackageVersion=$env:SNAPSHOT_VERSION
62-
Write-Host "Created package with version: $env:SNAPSHOT_VERSION"
63-
shell: powershell
64-
65-
- name: Publish
66-
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NEXUS_NUGET_APIKEY }} --source "https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/" --skip-duplicate
9+
uses: HydrologicEngineeringCenter/dotnet-workflows/.github/workflows/snapshot.yml@main
10+
with:
11+
dotnet-version: '9.0.x'
12+
project-names: 'Numerics'
13+
run-tests: true
14+
nuget-source: 'https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/'
15+
secrets:
16+
NUGET_API_KEY: ${{ secrets.NEXUS_NUGET_APIKEY }}

0 commit comments

Comments
 (0)