Skip to content

fix: working dirs

fix: working dirs #5

name: Build and deploy Node.js app to Azure Web App - lotr-backend
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Frontend build steps
- name: Set up Node.js version for frontend
uses: actions/setup-node@v3
with:
node-version: '18.x'
app_location: "/frontend"
- name: npm install for frontend
run: npm install
with:

Check failure on line 25 in .github/workflows/main_lotr-backend.yml

View workflow run for this annotation

GitHub Actions / Build and deploy Node.js app to Azure Web App - lotr-backend

Invalid workflow file

The workflow is not valid. .github/workflows/main_lotr-backend.yml (Line: 25, Col: 9): Unexpected value 'with' .github/workflows/main_lotr-backend.yml (Line: 31, Col: 9): Unexpected value 'with'
node-version: '18.x'
app_location: "/frontend"
- name: npm run test for frontend
run: npm run test --if-present
with:
node-version: '18.x'
app_location: "/frontend"
- name: npm run build for frontend
run: npm run build
with:
node-version: '18.x'
app_location: "/frontend"
output_location: "build"
# Copy build directory to backend
- name: Copy frontend build to backend
run: cp -R ./frontend/build/* ./backend/__BUILD/
# Backend build steps
- name: Set up Node.js version for backend
uses: actions/setup-node@v3
with:
node-version: '18.x'
working-directory: ./backend
- name: npm install, build, and test for backend
run: |
npm install
npm run test --if-present
working-directory: ./backend
- name: Zip artifact for deployment
run: zip release.zip ./* -r
working-directory: ./backend
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: backend/release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'lotr-backend'
slot-name: 'Production'
package: .
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_755D03D3D66E4CFEA1B7360C17082E2D }}