microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
88322a0b3f0c311a95730d3faeab445ada3988b2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

pipelines/azure-build-ts.yml

104lines · modepreview

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

resources:
  repositories:
    - repository: TypeAgent-GH
      type: github
      endpoint: AI_Systems
      name: microsoft/typeagent
      ref: refs/heads/main

trigger:
  branches:
    include:
      - main

pr:
  branches:
    exclude:
      - "*"

pool:
  vmImage: "ubuntu-latest"

variables:
  workingDirectory: "ts"
  agentsdk_folder: "ts/packages/agentSdk"

jobs:
  - job: build_ts
    displayName: "Build TypeScript Project"
    strategy:
      matrix:
        node_22:
          nodeVersion: "22"
    steps:
      - script: |
          sudo apt install libsecret-1-0
        displayName: "Install libsecret-1-0"
        condition: eq(variables['Agent.OS'], 'Linux')

      - checkout: TypeAgent-GH
        displayName: "Checkout TypeAgent Repository"
        path: "typeagent"

      - task: UseNode@1
        displayName: "Setup Node.js"
        inputs:
          version: $(nodeVersion)
          checkLatest: true

      - template: include-install-pnpm.yml
        parameters:
          buildDirectory: $(Build.SourcesDirectory)/ts

      - script: |
          pnpm install --frozen-lockfile --strict-peer-dependencies
        displayName: "Install dependencies"
        workingDirectory: $(workingDirectory)

      - script: |
          current_version=$(node -p "require('./package.json').version")
          new_version="${current_version}-$(Build.BuildId)"
          echo "##vso[task.setvariable variable=package_version]$new_version"
          jq ".version=\"$new_version\"" package.json > package.tmp.json
          mv package.tmp.json package.json
          echo "Updated package.json to version $new_version"
          cat package.json
        displayName: "Update Package Version"
        workingDirectory: $(agentsdk_folder)

      - script: |
          npm run build
        displayName: "Build"
        workingDirectory: $(workingDirectory)

      - script: |
          npm run test:local
        displayName: "Run Tests (Local)"
        workingDirectory: $(workingDirectory)

      - script: |
          npm run lint
        displayName: "Lint"
        workingDirectory: $(workingDirectory)

      - script: |
          echo $(ADO_REGISTRY)
          echo "registry=$(ADO_REGISTRY)" > .npmrc
          echo "always-auth=true" >> .npmrc
          cat .npmrc
        displayName: "Create .npmrc file."
        workingDirectory: $(agentsdk_folder)

      - task: npmAuthenticate@0
        inputs:
          workingFile: "$(agentsdk_folder)/.npmrc"
        displayName: "Authenticate with Azure Artifacts"

      - script: |
          cd $(Build.SourcesDirectory)/$(agentsdk_folder)
          npm publish --registry=$(ADO_REGISTRY)
        displayName: "Pack and Publish agent-sdk Module"
        condition: succeeded()