frontend/azure-pipelines.yml

61 lines
1.5 KiB
YAML

# Node.js with Angular
# Build a Node.js project that uses Angular.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: |
npm install -g @ionic/cli
npm update
npm install
ionic build --prod
displayName: 'npm install and build'
- task: CmdLine@2
inputs:
script: |
echo $(Build.Repository.LocalPath)
ls -la $(Build.Repository.LocalPath)
# # Archive files
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.Repository.LocalPath)/www'
includeRootFolder: true
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/target-www.tar.gz'
replaceExistingArchive: true
verbose: true
- task: PublishPipelineArtifact@1
inputs:
# targetPath: '$(Pipeline.Workspace)'
targetPath: '$(Build.ArtifactStagingDirectory)/target-www.tar.gz'
artifact: 'FrontEnd'
publishLocation: 'pipeline'
- task: CopyFilesOverSSH@0
displayName: 'Securely copy files to the remote machine'
inputs:
sshEndpoint: GoogleServer
sourceFolder: '$(Build.ArtifactStagingDirectory)'
targetFolder: /var/lib/app/pipeline/
failOnEmptySource: true
- task: SSH@0
displayName: 'Run shell commands on remote machine'
inputs:
sshEndpoint: GoogleServer
commands: '/var/lib/app/pipeline/frontend-deploy.sh'