diff --git a/.github/workflows/azure-cd.yml b/.github/workflows/azure-cd.yml new file mode 100644 index 00000000..8686f597 --- /dev/null +++ b/.github/workflows/azure-cd.yml @@ -0,0 +1,35 @@ +name: Azure Deploy + +on: + push: + branches: + - master + +env: + AZURE_WEBAPP_NAME: TypeScript-Node-Starter + AZURE_WEBAPP_PACKAGE_PATH: "." + NODE_VERSION: "12.x" + +jobs: + build-and-deploy: + name: Build and Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Start Docker for Mongodb + run: docker run -d -p 27017:27017 mongo + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + - name: "Deploy to Azure WebApp" + uses: azure/webapps-deploy@v1 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 82911da8..b77f0cdb 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -22,9 +22,12 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- + - name: Start Docker for Mongodb + run: docker run -d -p 27017:27017 mongo - name: npm install, build, and test run: | npm ci npm run build --if-present + npm run test --if-present env: CI: true diff --git a/README.md b/README.md index b94fe391..115a250f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TypeScript Node Starter -[![Dependency Status](https://david-dm.org/Microsoft/TypeScript-Node-Starter.svg)](https://david-dm.org/Microsoft/TypeScript-Node-Starter) [![Build Status](https://travis-ci.org/Microsoft/TypeScript-Node-Starter.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript-Node-Starter) +[![Dependency Status](https://david-dm.org/Microsoft/TypeScript-Node-Starter.svg)](https://david-dm.org/Microsoft/TypeScript-Node-Starter) [![Build Status](https://travis-ci.org/Microsoft/TypeScript-Node-Starter.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript-Node-Starter) ![Node CI](https://github.com/microsoft/TypeScript-Node-Starter/workflows/Node%20CI/badge.svg?branch=master) ![Azure Deploy](https://github.com/microsoft/TypeScript-Node-Starter/workflows/Azure%20Deploy/badge.svg?branch=master) **Live Demo**: [https://typescript-node-starter.azurewebsites.net/](https://typescript-node-starter.azurewebsites.net/)