From f18e8a553c4384b49d539e889da671131e442d53 Mon Sep 17 00:00:00 2001 From: jessin08 Date: Wed, 19 Feb 2020 21:18:31 +0100 Subject: [PATCH] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..bb74e3e --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,68 @@ +# Maven package Java project Web App to Linux on Azure +# Build your Java project and deploy it to Azure as a Linux web app +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- master + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: 'd708be47-a84f-45bd-b94c-f2590bdd1c44' + + # Web app name + webAppName: 'jez-app-name' + + # Environment name + environmentName: 'jez-app-name' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: MavenPackageAndPublishArtifacts + displayName: Maven Package and Publish Artifacts + pool: + vmImage: $(vmImageName) + + steps: + - task: Maven@3 + displayName: 'Maven Package' + inputs: + mavenPomFile: 'pom.xml' + + - task: CopyFiles@2 + displayName: 'Copy Files to artifact staging directory' + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: '**/target/*.?(war|jar)' + TargetFolder: $(Build.ArtifactStagingDirectory) + + - upload: $(Build.ArtifactStagingDirectory) + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + condition: succeeded() + jobs: + - deployment: DeployLinuxWebApp + displayName: Deploy Linux Web App + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: jez-app-name' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + package: '$(Pipeline.Workspace)/drop/**/target/*.?(war|jar)'