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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions .github/workflows/Integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Integration

on:
pull_request:
branches: [ main ]

env:
dotnet-version: '9.0.x'

jobs:
CI:
runs-on: windows-latest
env:
dotnet-version: '9.0.x'

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET Core SDK ${{ env.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet-version }}

- name: Test Solution
run: dotnet test --nologo -c Release
45 changes: 45 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Snapshot

on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: windows-latest

env:
dotnet-version: '9.0.x'

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core SDK ${{ env.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet-version }}

- name: Test
run: dotnet test -c Release

- name: Create version number
shell: pwsh
run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
$VERSION = $TAG -replace '^v', ''
echo "VERSION=$VERSION" >> $env:GITHUB_ENV

- name: Pack
shell: pwsh
run: |
# Use the snapshot version from the previous step
dotnet pack --configuration Release /p:PackageVersion=${{ env.VERSION }}

- name: Publish
shell: pwsh
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NEXUS_NUGET_APIKEY }} --source "https://www.hec.usace.army.mil/nexus/repository/fda-nuget/" --skip-duplicate

66 changes: 66 additions & 0 deletions .github/workflows/Snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Snapshot

on:
push:
branches: [ main ]

jobs:
build:
runs-on: windows-latest

env:
dotnet-version: '9.0.x'

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core SDK ${{ env.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet-version }}

- name: Test
run: dotnet test -c Release

- name: Get version from built assembly and set snapshot version
id: set-version
shell: powershell
run: |
# Get the assembly version from the built DLL. It's already built from the test step.
$assemblyPath = "Numerics/bin/Release/net8.0/Numerics.dll"

# Load the assembly and get its version
$assembly = [System.Reflection.Assembly]::LoadFrom((Resolve-Path $assemblyPath).Path)
$assemblyVersion = $assembly.GetName().Version

# Extract major.minor.patch from assembly version
$baseVersion = "$($assemblyVersion.Major).$($assemblyVersion.Minor).$($assemblyVersion.Build)"

# Create snapshot version with GitHub run number
$snapshotVersion = "${baseVersion}.${{ github.run_number }}-dev"

# Output the version for use in next steps
echo "SNAPSHOT_VERSION=$snapshotVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "BASE_VERSION=$baseVersion" | Out-File -FilePath $env:GITHUB_ENV -Append

# Also set as step output
echo "version=$snapshotVersion" >> $env:GITHUB_OUTPUT
echo "base_version=$baseVersion" >> $env:GITHUB_OUTPUT

# Display the version
Write-Host "Assembly Version: $assemblyVersion"
Write-Host "Base Version: $baseVersion"
Write-Host "Snapshot Version: $snapshotVersion"

- name: Pack
run: |
# Use the snapshot version from the previous step
dotnet pack --configuration Release /p:PackageVersion=$env:SNAPSHOT_VERSION
Write-Host "Created package with version: $env:SNAPSHOT_VERSION"
shell: powershell

- name: Publish
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NEXUS_NUGET_APIKEY }} --source "https://www.hec.usace.army.mil/nexus/repository/fda-nuget/" --skip-duplicate
Loading