diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 5b957f160e..c538f05854 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -48,6 +48,10 @@ jobs: shell: pwsh run: ../PowerShellEditorServices/tools/installPSResources.ps1 + - name: Deploy NPM configuration + shell: pwsh + run: Copy-Item .github/workflows/npmrc .npmrc + - uses: actions/setup-node@v4 with: node-version: 18 @@ -61,6 +65,8 @@ jobs: - name: Build, test and package shell: pwsh run: Invoke-Build + env: + NPM_AUTH_TOKEN: ${{ secrets.AZURE_NPM_TOKEN }} - name: Upload build artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/npmrc b/.github/workflows/npmrc new file mode 100644 index 0000000000..b40e145d9c --- /dev/null +++ b/.github/workflows/npmrc @@ -0,0 +1,13 @@ +; This requires NPM_AUTH_TOKEN to be available as a base64 encoded secret, since +; Azure DevOps does not support actual auth tokens. + +; begin auth token +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:username=powershell-rel +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:_password=${NPM_AUTH_TOKEN} +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:email=powershell-rel +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:username=powershell-rel +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:_password=${NPM_AUTH_TOKEN} +//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:email=powershell-rel +; end auth token +registry=https://pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/ +always-auth=true diff --git a/.vsts-ci/templates/publish-markets.yml b/.vsts-ci/templates/publish-markets.yml index 0cadb54960..16f686a5ae 100644 --- a/.vsts-ci/templates/publish-markets.yml +++ b/.vsts-ci/templates/publish-markets.yml @@ -10,7 +10,7 @@ steps: workingFile: .npmrc - pwsh: | - npm ci --loglevel=error + npm ci --loglevel=error --ignore-scripts Import-Module $(Build.SourcesDirectory)/tools/VersionTools.psm1 $Version = Get-Version -RepositoryName vscode-powershell $PackageVersion = Get-MajorMinorPatch -Version $Version diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index bdca9c9700..ad75b91bbf 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -26,8 +26,8 @@ task RestoreNodeModules -If { !(Test-Path ./node_modules) } { Write-Host "`n### Restoring vscode-powershell dependencies`n" -ForegroundColor Green # When in a CI build use the --loglevel=error parameter so that # package install warnings don't cause PowerShell to throw up - if ($env:TF_BUILD) { - Invoke-BuildExec { & npm ci --loglevel=error } + if ($env:CI -or $env:TF_BUILD) { + Invoke-BuildExec { & npm ci --loglevel=error --ignore-scripts } } else { Invoke-BuildExec { & npm install } }