trigger: none

pr: none

pool:
  vmImage: 'ubuntu-20.04'

variables:
- group: Release Secrets for GitHub
- name: MAVEN_CACHE_FOLDER
  value: $(Pipeline.Workspace)/.m2/repository
- name: MAVEN_OPTS
  value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
- name: NodeVersion
  value: '16.x'

steps:
- bash: |
    sudo apt-get install -y --upgrade python3-pip python3-setuptools
    pip3 install --upgrade wheel
    pip3 install --upgrade PyYAML requests
  displayName: Update python

- task: NodeTool@0
  displayName: 'Install Node.js $(NodeVersion)'
  inputs:
    versionSpec: '$(NodeVersion)'

- bash: |
    npm install -g autorest
  displayName: 'Install autorest'

- bash: |
    export PATH=$JAVA_HOME_11_X64/bin:$PATH
    java -version
    ./eng/mgmt/automation/generate_data.py --readme="$(README)" --spec-readme="$(SPEC_README)" --input-file="$(INPUT_FILE)" --service="$(SERVICE)" --module="$(MODULE)" --security="$(SECURITY)" --security-scopes="$(SECURITY_SCOPES)" --title="$(TITLE)"
  displayName: Generation

- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
  parameters:
    PRBranchName: fluent-lite-generation-$(Build.BuildId)
    CommitMsg: '[Automation] Generate Data-plane SDK for $(MODULE)#$(README)'
    PRTitle: '[Automation] Generate Data-plane SDK for $(MODULE)#$(README)'
    PRLabels: 'LLC'
    OpenAsDraft: 'true'
