From 2cf076890aec7db8200afc0a0f9435ed66176df8 Mon Sep 17 00:00:00 2001 From: XiaoYun Zhang Date: Wed, 31 Jan 2024 16:58:38 -0800 Subject: [PATCH] update build pipeline to add publish to internal feed --- .github/workflows/dotnet-build.yml | 59 +++++++++++++- dotnet/.azure-pipeline/nightly-build.yml | 99 ------------------------ 2 files changed, 56 insertions(+), 102 deletions(-) delete mode 100644 dotnet/.azure-pipeline/nightly-build.yml diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 32c87fb857a1..4a7289af8d7d 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -32,8 +32,61 @@ jobs: - name: Restore dependencies run: | # dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config - dotnet restore + dotnet restore -bl - name: Build - run: dotnet build --no-restore + run: | + echo "Build AutoGen" + dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true - name: Unit Test - run: dotnet test --no-build --verbosity normal + run: dotnet test --no-build -bl + - name: Pack + run: | + echo "Create nightly build package" + dotnet pack --no-build --configuration Release --output './output/nightly' -p:VersionSuffix=nightly-$(Build.BuildNumber) -bl + + echo "Create release build package" + dotnet pack --no-build --configuration Release --output './output/release' -bl + + echo "ls output directory" + ls -R ./output + - name: Upload package + uses: actions/upload-artifact@v2 + with: + name: nightly + path: ./output/nightly + - name: Upload package + uses: actions/upload-artifact@v2 + with: + name: release + path: ./output/release + publish: + name: Publish + runs-on: ubuntu-latest + defaults: + run: + working-directory: dotnet + needs: build + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + global-json-file: dotnet/global.json + - uses: actions/download-artifact@v2 + with: + name: nightly + path: ./output/nightly + - uses: actions/download-artifact@v2 + with: + name: release + path: ./output/release + - name: Publish nightly package to Azure Devops + run: | + echo "Publish nightly package to Azure Devops" + echo "ls output directory" + ls -R ./output/nightly + dotnet nuget push --api-key AzureArtifacts ./output/nightly/*.nupkg + dotnet nuget push --api-key AzureArtifacts ./output/nightly/*.snupkg + env: + AZURE_ARTIFACTS_FEED_URL: https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/AutoGen/nuget/v3/index.json + NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }} + diff --git a/dotnet/.azure-pipeline/nightly-build.yml b/dotnet/.azure-pipeline/nightly-build.yml deleted file mode 100644 index 0674572bd592..000000000000 --- a/dotnet/.azure-pipeline/nightly-build.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: $(Date:yyMMdd)$(Rev:.r) - -trigger: - branches: - include: - - dotnet - -pr: none - -variables: -- name: TeamName - value: machinelearning-tools -- name: SignType - value: Real -- name: buildConfiguration - value: Release -- name: solution - value: 'dotnet/AutoGen.sln' - -stages: -##################################### -### STAGE: Build AutoGen -##################################### -- stage: Build_and_Pack - jobs: - - job: Build - displayName: Build - pool: - name: VSEngSS-MicroBuild2022-1ES - workspace: - clean: all - - steps: - - checkout: self - displayName: checkout - clean: true - - - task: UseDotNet@2 - inputs: - packageType: 'sdk' - useGlobalJson: true - workingDirectory: 'dotnet' - - task: NuGetToolInstaller@1 - displayName: 'NuGet tool installer' - - task: NuGetAuthenticate@1 - inputs: - forceReinstallCredentialProvider: true - - task: MicroBuildSigningPlugin@4 - displayName: 'Install Signing Plugin' - inputs: - signType: $(SignType) - esrpSigning: true - zipSources: false - feedSource: 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json' - - powershell: | - echo "Restore packages" - echo "add dotnet-tool feed" - # dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config - dotnet restore -bl - workingDirectory: '$(Build.SourcesDirectory)/dotnet' - displayName: 'dotnet restore /p:SignType=$(SignType)' - - - powershell: | - echo "Build AutoGen" - dotnet build -c $(buildConfiguration) --no-restore -bl /p:SignAssembly=true /p:SignType=$(SignType) - displayName: build - workingDirectory: '$(Build.SourcesDirectory)/dotnet' - - - powershell: | - echo "Create nightly build package" - dotnet pack -c $(buildConfiguration) --output '$(Build.ArtifactStagingDirectory)/nightly' -p:VersionSuffix=nightly-$(Build.BuildNumber) --no-restore --no-build -bl /p:SignType=Test - echo "Create release package" - dotnet pack -c $(buildConfiguration) --output $(Build.ArtifactStagingDirectory) --no-restore --no-build -bl /p:SignType=$(SignType) - echo "Contents of Build.ArtifactStagingDirectory..." - ls -R $(Build.ArtifactStagingDirectory) - workingDirectory: '$(Build.SourcesDirectory)/dotnet' - displayName: 'dotnet pack' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish nightly package to nightly folder' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/nightly' - artifact: 'nightly' - publishLocation: 'pipeline' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish release package to release folder' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - artifact: 'release' - publishLocation: 'pipeline' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish build log to buildlog folder' - inputs: - targetPath: '$(Build.SourcesDirectory)/dotnet/bin/$(buildConfiguration)/*.binlog' - artifact: 'buildlog' - publishLocation: 'pipeline' -