Skip to content

Commit

Permalink
Simplify .NET version in ADO publish pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongin committed Sep 24, 2023
1 parent 9a9015a commit ea83f9a
Showing 1 changed file with 10 additions and 32 deletions.
42 changes: 10 additions & 32 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,29 @@ parameters:
- Name: win_x64
VMImage: windows-latest
TargetRuntime: win-x64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true
- Name: win_arm64
VMImage: windows-latest
TargetRuntime: win-arm64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true
- Name: osx_x64
VMImage: macos-latest
TargetRuntime: osx-x64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true
- Name: osx_arm64
VMImage: macos-latest
TargetRuntime: osx-arm64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true
- Name: linux_x64
VMImage: ubuntu-latest
TargetRuntime: linux-x64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true

jobs:
# Build Native AOT .Net hosts for Node-API modules.
- ${{ each matrixEntry in parameters.buildMatrix }}:
- job: buildAOTBinary${{ matrixEntry.Name }}
displayName: Build ${{ matrixEntry.TargetRuntime }} AOT binary

variables:
DotNetMoniker: net8.0

pool:
vmImage: ${{ matrixEntry.VMImage }}

Expand All @@ -69,40 +58,32 @@ jobs:
lfs: false

- task: UseDotNet@2
displayName: Install .Net ${{ matrixEntry.DotNetVersion }}
displayName: Install .NET SDK using global.json
inputs:
packageType: sdk
version: ${{ matrixEntry.DotNetVersion }}
includePreviewVersions: ${{ eq(matrixEntry.UseGlobalJson, false) }}
useGlobalJson: ${{ matrixEntry.UseGlobalJson }}
useGlobalJson: true

- script: env
displayName: Print environment

- script: dotnet --info
displayName: Print .Net info

- task: DeleteFiles@1 # To enable net8.0 use for osx-arm64
displayName: Delete global.json
inputs:
Contents: global.json
condition: eq(${{ matrixEntry.UseGlobalJson }}, false)

- script: >
dotnet publish
--configuration Release
--runtime ${{ matrixEntry.TargetRuntime }}
--no-self-contained
--framework ${{ matrixEntry.DotNetMoniker }}
--framework $(DotNetMoniker)
displayName: Build Native AOT binaries
env:
TargetFrameworks: ${{ matrixEntry.DotNetMoniker }}
TargetFrameworks: $(DotNetMoniker)
- task: CopyFiles@2
displayName: Copy Native AOT binaries to staging
inputs:
sourceFolder: "$(Build.SourcesDirectory)/out/bin/Release/NodeApi/\
${{ matrixEntry.DotNetMoniker }}/${{ matrixEntry.TargetRuntime }}/publish"
$(DotNetMoniker)/${{ matrixEntry.TargetRuntime }}/publish"
targetFolder: $(Build.StagingDirectory)/AOT/${{ matrixEntry.TargetRuntime }}
contents: Microsoft.JavaScript.NodeApi.node

Expand All @@ -126,9 +107,7 @@ jobs:
variables:
VMImage: windows-latest
TargetRuntime: win-x64
DotNetVersion: 8.0.x
DotNetMoniker: net8.0
UseGlobalJson: true
TargetRuntimeList:

pool:
Expand All @@ -149,11 +128,10 @@ jobs:
version: 6.0.x

- task: UseDotNet@2
displayName: Install .Net $(DotNetVersion)
displayName: Install .NET SDK using global.json
inputs:
packageType: sdk
version: $(DotNetVersion)
useGlobalJson: $(UseGlobalJson)
useGlobalJson: true

- script: env
displayName: Print environment
Expand Down

0 comments on commit ea83f9a

Please sign in to comment.