From 96faf92c12c833b2244569f8a6a977fdb41bcca2 Mon Sep 17 00:00:00 2001 From: jawelton74 <103591340+jawelton74@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:37:30 -0800 Subject: [PATCH] Use dotnet CLI for nuget operations in CI pipeline (#2026) * Start of moving nuget actions to use dotnet. * Comment out env section * Set auth token. * Disable globalization support. * Comment out dotnet setup. * Copy proj file with build. * PLace Content item under ItemGroup. * Update project with Sdk and No Build args. * Remove no-build from cmd line. * Set TargetFramework version. * Fix TargetFramework value. * Add nuget push command. * Fix test version string * Add nuget add source step. * Fix add source args. * Enable cleartext password, remove source after completion. * Use wildcard for nupkg path. Add debug. * Remove debug. * Fix nupkg path * Fix API key argument * Re-enable MPAC nuget. Tidy up ci.yml. * Fix formatting of webpack config. * Remove Globalization flag. * Revert test changes. --- .github/workflows/ci.yml | 25 +++++++++++-------------- DataExplorer.proj | 9 +++++++++ webpack.config.js | 7 ++++++- 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 DataExplorer.proj diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f38ef82e..1924e7e61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,21 +113,20 @@ jobs: NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }} AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} steps: - - uses: nuget/setup-nuget@v2 - with: - nuget-api-key: ${{ secrets.NUGET_API_KEY }} - name: Download Dist Folder uses: actions/download-artifact@v4 with: name: dist - run: cp ./configs/prod.json config.json - - run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "jawelton@microsoft.com" -Password "$AZURE_DEVOPS_PAT" - - run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}" - - run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg + - run: dotnet nuget add source "$NUGET_SOURCE" --name "ADO" --username "jawelton@microsoft.com" --password "$AZURE_DEVOPS_PAT" --store-password-in-clear-text + - run: dotnet pack DataExplorer.proj /p:PackageVersion="2.0.0-github-${GITHUB_SHA}" + - run: dotnet nuget push "bin/Release/*.nupkg" --skip-duplicate --api-key Az --source="$NUGET_SOURCE" + - run: dotnet nuget remove source "ADO" - uses: actions/upload-artifact@v4 name: packages with: - path: "*.nupkg" + path: "bin/Release/*.nupkg" + nugetmpac: name: Publish Nuget MPAC if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') @@ -137,22 +136,20 @@ jobs: NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }} AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} steps: - - uses: nuget/setup-nuget@v2 - with: - nuget-api-key: ${{ secrets.NUGET_API_KEY }} - name: Download Dist Folder uses: actions/download-artifact@v4 with: name: dist - run: cp ./configs/mpac.json config.json - run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec - - run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "jawelton@microsoft.com" -Password "$AZURE_DEVOPS_PAT" - - run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}" - - run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg + - run: dotnet nuget add source "$NUGET_SOURCE" --name "ADO" --username "jawelton@microsoft.com" --password "$AZURE_DEVOPS_PAT" --store-password-in-clear-text + - run: dotnet pack DataExplorer.proj /p:PackageVersion="2.0.0-github-${GITHUB_SHA}" + - run: dotnet nuget push "bin/Release/*.nupkg" --skip-duplicate --api-key Az --source="$NUGET_SOURCE" + - run: dotnet nuget remove source "ADO" - uses: actions/upload-artifact@v4 name: packages with: - path: "*.nupkg" + path: "bin/Release/*.nupkg" playwright-tests: name: "Run Playwright Tests (Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }})" diff --git a/DataExplorer.proj b/DataExplorer.proj new file mode 100644 index 000000000..aa18a3e83 --- /dev/null +++ b/DataExplorer.proj @@ -0,0 +1,9 @@ + + + net8.0 + true + false + DataExplorer.nuspec + version=$(PackageVersion) + + \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index c21baf3ef..f594602d4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -187,7 +187,12 @@ module.exports = function (_env = {}, argv = {}) { }), new MonacoWebpackPlugin(), new CopyWebpackPlugin({ - patterns: [{ from: "DataExplorer.nuspec" }, { from: "web.config" }, { from: "quickstart/*.zip" }], + patterns: [ + { from: "DataExplorer.nuspec" }, + { from: "DataExplorer.proj" }, + { from: "web.config" }, + { from: "quickstart/*.zip" }, + ], }), new EnvironmentPlugin(envVars), ];