fix: working dirs #5
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: 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 GitHub Actions / Build and deploy Node.js app to Azure Web App - lotr-backendInvalid workflow file
|
||
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 }} |