# yaml-language-server: $schema=https://aka.ms/m365-agents-toolkits/v1.11/yaml.schema.json
# Generated by 'atk import openplugin'.
version: v1.11

environmentFolderPath: ./env

# Triggered when 'atk provision' is executed
provision:
  - uses: teamsApp/create
    with:
      name: {{appName}}${{APP_NAME_SUFFIX}}
    writeToEnvironmentFile:
      teamsAppId: TEAMS_APP_ID

  - uses: teamsApp/zipAppPackage
    with:
      manifestPath: ./appPackage/manifest.json
      outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
      outputFolder: ./appPackage/build

  - uses: teamsApp/update
    with:
      appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip

  # Extend the agent to Outlook and the Microsoft 365 app so it can be uploaded to MOS3.
  - uses: copilotAgent/publish
    with:
      appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
      scope: ${{AGENT_SCOPE}}
    writeToEnvironmentFile:
      titleId: M365_TITLE_ID
      appId: M365_APP_ID
      shareLink: SHARE_LINK

# Triggered when 'atk publish' is executed
publish:
  - uses: teamsApp/zipAppPackage
    with:
      manifestPath: ./appPackage/manifest.json
      outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
      outputFolder: ./appPackage/build
  - uses: teamsApp/update
    with:
      appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
  # Publish the agent to the tenant app catalog.
  - uses: copilotAgent/publish
    with:
      appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
      scope: tenant
    writeToEnvironmentFile:
      titleId: M365_PUBLISHED_TITLE_ID
      appId: M365_PUBLISHED_APP_ID

