Publish npm packages, NuGet packages, and Docker images to DepAegis from your Azure DevOps pipelines. This guide covers service connections, pipeline variables, and complete YAML examples.
There are two ways to provide your DepAegis token to Azure Pipelines:
depaegis-creds) and add a variable named DEPAEGIS_TOKEN with your token value.depaegis-npm (or depaegis-nuget)https://app.depaegis.com/ (or NuGet feed URL)A pipeline that publishes an npm package on tag push:
# azure-pipelines.yml
trigger:
tags:
include:
- "v*"
variables:
- group: depaegis-creds
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: "20.x"
displayName: "Install Node.js"
- script: npm ci
displayName: "Install dependencies"
- script: npm run build
displayName: "Build"
- script: |
cat > .npmrc <<EOF
//app.depaegis.com/:_authToken=$(DEPAEGIS_TOKEN)
@my-org:registry=https://app.depaegis.com/api/v1/npm/
EOF
displayName: "Configure .npmrc"
env:
DEPAEGIS_TOKEN: $(DEPAEGIS_TOKEN)
- script: npm publish
displayName: "Publish to DepAegis"
env:
NODE_AUTH_TOKEN: $(DEPAEGIS_TOKEN).npmrc is generated at build time from the secret variable. Do not commit .npmrc files containing tokens to the repository.Build and push .NET packages using the built-in NuGet task:
# azure-pipelines.yml
trigger:
tags:
include:
- "v*"
variables:
- group: depaegis-creds
pool:
vmImage: "ubuntu-latest"
steps:
- task: UseDotNet@2
inputs:
packageType: "sdk"
version: "10.0.x"
displayName: "Install .NET SDK"
- script: dotnet pack MyPackage.csproj -c Release -o $(Build.ArtifactStagingDirectory)
displayName: "Pack NuGet package"
- task: NuGetCommand@2
inputs:
command: "push"
packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg"
publishVstsFeed: false
externalEndpoint: "depaegis-nuget"
displayName: "Push to DepAegis"externalEndpoint references the service connection you created earlier. If you prefer variable-based auth, use a script task with dotnet nuget push --api-key $(DEPAEGIS_TOKEN) instead.Build and push a Docker image to the DepAegis container registry:
# azure-pipelines.yml
trigger:
tags:
include:
- "v*"
variables:
- group: depaegis-creds
imageName: "app.depaegis.com/my-org/my-app"
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
displayName: "Log in to DepAegis Container Registry"
inputs:
command: login
containerRegistry: "depaegis-docker"
- task: Docker@2
displayName: "Build image"
inputs:
command: build
repository: "app.depaegis.com/my-org/my-app"
tags: |
$(Build.SourceBranchName)
latest
- task: Docker@2
displayName: "Push image"
inputs:
command: push
repository: "app.depaegis.com/my-org/my-app"
tags: |
$(Build.SourceBranchName)
latestA multi-stage pipeline with build, test, and publish:
# azure-pipelines.yml
trigger:
tags:
include:
- "v*"
variables:
- group: depaegis-creds
NPM_REGISTRY: "https://app.depaegis.com/"
NUGET_SOURCE: "https://nuget.app.depaegis.com/api/v1/nuget/v3/index.json"
stages:
- stage: Test
jobs:
- job: test_node
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: "20.x"
- script: npm ci
- script: npm test
- job: test_dotnet
pool:
vmImage: "ubuntu-latest"
steps:
- task: UseDotNet@2
inputs:
packageType: "sdk"
version: "10.0.x"
- script: dotnet test
- stage: Publish
dependsOn: Test
jobs:
- job: publish_npm
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: "20.x"
- script: npm ci
- script: npm run build
- script: |
cat > .npmrc <<EOF
//app.depaegis.com/:_authToken=$(DEPAEGIS_TOKEN)
@my-org:registry=https://app.depaegis.com/api/v1/npm/
EOF
env:
DEPAEGIS_TOKEN: $(DEPAEGIS_TOKEN)
- script: npm publish
env:
NODE_AUTH_TOKEN: $(DEPAEGIS_TOKEN)
- job: publish_nuget
pool:
vmImage: "ubuntu-latest"
steps:
- task: UseDotNet@2
inputs:
packageType: "sdk"
version: "10.0.x"
- script: dotnet pack MyPackage.csproj -c Release -o $(Build.ArtifactStagingDirectory)
- task: NuGetCommand@2
inputs:
command: "push"
packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg"
externalEndpoint: "depaegis-nuget"
- job: publish_docker
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
inputs:
command: login
containerRegistry: "depaegis-docker"
- task: Docker@2
inputs:
command: buildAndPush
repository: "app.depaegis.com/my-org/my-app"
tags: |
$(Build.SourceBranchName)
latestFor the full pipeline above, create three service connections in Azure DevOps:
| Connection Name | Type | Server URL | Used By |
|---|---|---|---|
depaegis-nuget | NuGet | https://nuget.app.depaegis.com/api/v1/nuget/v3/index.json | NuGetCommand@2 push |
depaegis-docker | Docker Registry | https://app.depaegis.com | Docker@2 login/push |
depaegis-npm (optional) | Generic | https://app.depaegis.com/ | Custom script auth |
.npmrc is the most common pattern. A Generic service connection is useful if you want to call the DepAegis REST API directly from a script task.