# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '17.x'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Agent.BuildDirectory)/s'
    Contents: |
      **
      !azure-pipelines.yml
      !package-lock.json
      !package.json
      !README.md
      !tsconfig.json
      !**/.git/**
      !**/node_modules/**
    TargetFolder: '$(Agent.BuildDirectory)/upload'
  displayName: Copy files to be uploaded to webspace in upload folder
- task: FtpUpload@2
  inputs:
    credentialsOption: 'inputs'
    serverUrl: 'ftp://e81782-ftp.services.easyname.eu'
    username: '127175ftp1'
    password: '.22ma1rzqi14'
    rootDirectory: '$(Agent.BuildDirectory)/upload'
    filePatterns: '**'
    remoteDirectory: '/html/apps/technikum/'
    clean: false
    cleanContents: true
    preservePaths: true
    trustSSL: false
  displayName: upload specified folder to webspace

