From b46d41b460c452192b571d70aaf11248faa062b3 Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Thu, 11 Jan 2024 14:28:38 -0500 Subject: [PATCH] add github action to build and deploy the dev CD/service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NOTE: For testing, this is set to run on pushes to the elr/gh-action-dev-deploy branch. It won’t run on initial push, but will run on following pushes. TODO: Update trigger to deploy on merge to master branch. --- .github/workflows/build_and_deploy_dev.yml | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/build_and_deploy_dev.yml diff --git a/.github/workflows/build_and_deploy_dev.yml b/.github/workflows/build_and_deploy_dev.yml new file mode 100644 index 000000000..b68f80a0d --- /dev/null +++ b/.github/workflows/build_and_deploy_dev.yml @@ -0,0 +1,36 @@ +name: JavaScript CI + +on: + push: + branches: + - elr/gh-action-dev-deploy + +env: + AZURE_WEBAPP_NAME: clearlydefined-api-dev + # AZURE_WEBAPP_PACKAGE_PATH: 'my-app-path' # TODO: confirm that root is the webapp root (default is root) + NODE_VERSION: '18' # TODO: does this need to have a minor version? + +jobs: + build-and-deploy: + name: Build and Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - name: npm install, build, and test + run: | + # Build and test the project, then + # deploy to Azure Web App. + npm install + npm run build --if-present + npm run test --if-present + working-directory: my-app-path + - name: 'Deploy to Azure WebApp' + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + # package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} # TODO: uncomment if determined that root is not the webapp root