-
Notifications
You must be signed in to change notification settings - Fork 58
72 lines (70 loc) · 3.33 KB
/
file-handler-example-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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
on:
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: filehandlerdemo # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: './filehandler' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '14.15.1' # set this to the node version to use
ENV_FILE_NAME: ".env.local"
NODE_ENV: "production"
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
environment: production
defaults:
run:
working-directory: samples/file-handler
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create ${{ env.ENV_FILE_NAME }} file
run: |
touch ${{ env.ENV_FILE_NAME }}
echo IRON_SESSION_PASSWORD='${{ secrets.IRON_SESSION_PASSWORD }}' >> ${{ env.ENV_FILE_NAME }}
echo NODE_ENV='production' >> ${{ env.ENV_FILE_NAME }}
echo AAD_MSAL_AUTH_TENANT_ID='${{ secrets.AAD_MSAL_AUTH_TENANT_ID }}' >> ${{ env.ENV_FILE_NAME }}
echo AAD_MSAL_AUTH_ID='${{ secrets.AAD_MSAL_AUTH_ID }}' >> ${{ env.ENV_FILE_NAME }}
echo AAD_MSAL_AUTH_SECRET='${{ secrets.AAD_MSAL_AUTH_SECRET }}' >> ${{ env.ENV_FILE_NAME }}
echo FILEHANDLER_SITE_HOST_URL='${{ secrets.FILEHANDLER_SITE_HOST_URL }}' >> ${{ env.ENV_FILE_NAME }}
cat ${{ env.ENV_FILE_NAME }}
- name: npm install, build, remove node_modules
run: |
npm install --production=false
npm run build
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
npm install
- 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 }}
- name: 'debug: list dir'
if: always()
run: |
# Build and test the project, then
# deploy to Azure Web App.
find .