diff --git a/.github/workflows/master_coopcare.yml b/.github/workflows/master_coopcare.yml new file mode 100644 index 0000000..12bbb9f --- /dev/null +++ b/.github/workflows/master_coopcare.yml @@ -0,0 +1,62 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Node.js app to Azure Web App - CoopCare + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + + - name: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v3 + with: + name: node-app + path: release.zip + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v3 + with: + name: node-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'CoopCare' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_2A30A6A8139246DDB07DE5076026D0DC }} + package: . diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6b61141 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..7d573b7 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/.vs/web-app/FileContentIndex/292fe114-378a-4815-b095-f1b2c0c329a8.vsidx b/.vs/web-app/FileContentIndex/292fe114-378a-4815-b095-f1b2c0c329a8.vsidx new file mode 100644 index 0000000..fc7c939 Binary files /dev/null and b/.vs/web-app/FileContentIndex/292fe114-378a-4815-b095-f1b2c0c329a8.vsidx differ diff --git a/.vs/web-app/FileContentIndex/ee11490e-0856-4c37-a751-5b05ff7908bd.vsidx b/.vs/web-app/FileContentIndex/ee11490e-0856-4c37-a751-5b05ff7908bd.vsidx new file mode 100644 index 0000000..32f8bf1 Binary files /dev/null and b/.vs/web-app/FileContentIndex/ee11490e-0856-4c37-a751-5b05ff7908bd.vsidx differ diff --git a/.vs/web-app/v17/.wsuo b/.vs/web-app/v17/.wsuo new file mode 100644 index 0000000..1fa10a2 Binary files /dev/null and b/.vs/web-app/v17/.wsuo differ diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..ce4b723 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,78 @@ +# Node.js Express Web App to Linux on Azure +# Build a Node.js Express app 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/javascript + +trigger: +- master + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: '84417ef6-f789-4aa1-b851-175a3fd2925e' + + # Web app name + webAppName: 'CoopCare' + + # Environment name + environmentName: 'CoopCare' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + + steps: + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + + - script: | + npm install + npm run build --if-present + npm run test --if-present + displayName: 'npm install, build and test' + + - task: ArchiveFiles@2 + displayName: 'Archive files' + inputs: + rootFolderOrFile: '$(System.DefaultWorkingDirectory)' + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + replaceExistingArchive: true + + - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + condition: succeeded() + jobs: + - deployment: Deploy + displayName: Deploy + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: CoopCare' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + runtimeStack: 'NODE|10.10' + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip + startUpCommand: 'npm run start' \ No newline at end of file