version: 39
jobs:
- name: Build
  steps:
  - !CheckoutStep
    name: Checkout code
    cloneCredential: !DefaultCredential {}
    withLfs: true
    withSubmodules: true
    cloneDepth: 1
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !CommandStep
    name: Build and push
    runInContainer: true
    image: onedev.site.tesses.net/crosslang/crosslangextras/crosslangextras:latest
    interpreter: !DefaultInterpreter
      commands: |
        cd Tesses.YouTubeDownloader.Server
        crosslang build
        crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/"
        cd ../Tesses.YouTubeDownloader
        crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/"
        cd ../Tesses.YouTubeDownloader.PluginTemplate
        crosslang build
        crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/"
    envVars:
    - name: CPKG_KEY
      value: '@secret:CPKG_KEY@'
    useTTY: true
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !BuildImageStep
    name: Build Container
    output: !RegistryOutput
      tags: onedev.site.tesses.net/tytd2025:latest
    registryLogins:
    - registryUrl: '@server_url@'
      userName: '@job_token@'
      passwordSecret: dockersecret
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  triggers:
  - !BranchUpdateTrigger
    branches: master
    projects: tytd2025
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  timeout: 14400
