Skip to content

Stage|Front End|Marketplace - Deploy to Azure #300

Stage|Front End|Marketplace - Deploy to Azure

Stage|Front End|Marketplace - Deploy to Azure #300

# This workflow will build and push a node.js application to an Azure Web App when a release is created.
#
# This workflow assumes you have already created the target Azure App Service web app.
# For instructions see https://docs.microsoft.com/azure/app-service/app-service-plan-manage#create-an-app-service-plan
#
# To configure this workflow:
#
# 1. For Linux apps, add an app setting called WEBSITE_WEBDEPLOY_USE_SCM and set it to true in your app **before downloading the file**.
# For more instructions see: https://docs.microsoft.com/azure/app-service/configure-common#configure-app-settings
#
# 2. Set up a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE with the value of your Azure publish profile.
# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret
#
# 3. Change the values for the AZURE_WEBAPP_NAME, AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables (below).
#
# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples
name: Stage|Front End|Marketplace - Deploy to Azure
on:
#manually trigger deploy
workflow_dispatch:
push:
branches: develop
#release:
# types: [created]
env:
# set this to your application's name
AZURE_WEBAPP_NAME: 'marketplace-front-stage'
# set this to the path to your build output, defaults to the repository root
BUILD_OUTPUT_DIRECTORY: './frontend/build'
WORKING_DIRECTORY: 'frontend'
# set this to the node version to use
NODE_VERSION: '14.17.3'
jobs:
Build-and-Deploy-FrontEnd:
name: 'Build and Deploy React front End'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Copy robots.Staging.txt into robots.txt (stage environment only)'
run: |
echo '#dir command'
dir
echo ''
echo '#robots.Staging.txt contents:'
cat frontend/robots.Staging.txt
echo '---------------------------'
echo ''
echo '#robots.txt contents:'
cat frontend/public/robots.txt
echo ''
echo '#copying robots.txt - staging'
cp frontend/robots.Staging.txt frontend/public/robots.txt
echo ''
echo '#robots.txt contents REVISED:'
cat frontend/public/robots.txt
echo '---------------------------'
echo ''
- name: 'Remove sitemap.xml (stage environment only)'
run: |
echo '#dir command'
dir
echo ''
echo '#remove Sitemap.xml:'
rm frontend/public/sitemap.xml
echo ''
- name: 'Build React Code - npm install, build'
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
CI: '' #bypass treating-warnings-as-errors-because-process-env-ci-true
run: |
# Build the project, then
# deploy to Azure Web App.
npm install
npm run build:staging --if-present
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.STAGE_AZURE_MARKETPLACE_FRONT_PUBLISHSETTINGS }}
package: ${{ env.BUILD_OUTPUT_DIRECTORY }}