Skip to content

Small coffee

Small coffee #113

Workflow file for this run

# 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: Azure-Deploy
on:
push:
branches: [ main ]
env:
AZURE_WEBAPP_NAME: beastie-book # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: './api/dist' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '12.x' # set this to the node version to use
REACT_APP_API_BASE_URL: api
INLINE_RUNTIME_CHUNK: false
REACT_APP_APPINSIGHTS_INSTRUMENTATIONKEY: ${{secrets.REACT_APP_APPINSIGHTS_INSTRUMENTATIONKEY}}
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: windows-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: npm install, build, and test
run: |
# Build and test the project, then
# deploy to Azure Web App.
npm install yarn --no-package-lock
yarn
yarn build --if-present
echo "Now to do everything myself *sigh*"
cp -R api/src/data api/dist
cp api/package.json api/dist/package.json
cp api/yarn.lock api/dist/yarn.lock
cd api/dist
yarn --production
cd ../..
rm api/dist/package.json
rm api/dist/yarn.lock
cp -r ui/build/* api/dist/public
cp web.config api/dist
- 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 }}