Deploy Node.js to Azure Web App, Master #198
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Node.js to Azure Web App, Master | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
AZURE_WEBAPP_NAME: pos-backend-staging # set this to your application's name | |
AZURE_WEBAPP_PACKAGE_PATH: 'dist' # set this to the path to your web app project, defaults to the repository root | |
NODE_VERSION: '18.x' # set this to the node version to use | |
YARN_VERSION: '1.22.22' # set this to the desired Yarn version | |
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 }} | |
yarn-version: ${{ env.YARN_VERSION }} | |
- name: Check Yarn version | |
run: yarn --version | |
- name: Check Node.js version | |
run: node --version | |
- name: yarn install and build | |
run: | | |
# Build and test the project, then | |
# deploy to Azure Web App. | |
yarn install | |
yarn build | |
- name: run database migrations | |
run: DATABASE_URL=${{ secrets.DATABASE_URL_STAGING }} yarn migrate-up | |
- name: copy web.config and node_modules to dist | |
run: | | |
cp web.config dist/web.config | |
cp package.json dist/package.json | |
cp yarn.lock dist/yarn.lock | |
cp .deployment dist/.deployment | |
cp deploy.sh dist/deploy.sh | |
- name: 'Deploy to Azure WebApp' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} | |
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |