Skip to content

updated github actions yml #17

updated github actions yml

updated github actions yml #17

on:
push:
branches: [ "develop" ]
workflow_dispatch:
env:
AZURE_WEBAPP_NAME_BACKEND: talosave-backend # set this to your backend application's name
AZURE_WEBAPP_PACKAGE_PATH_BACKEND: './ts-backend' # set this to the path to your backend project
AZURE_WEBAPP_NAME_FRONTEND: talosave-frontend # set this to your frontend application's name
AZURE_WEBAPP_PACKAGE_PATH_FRONTEND: './ts-frontend' # set this to the path to your frontend project
NODE_VERSION: '20.x' # set this to the node version to use
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install, build, and test backend
run: |
cd ${{ env.AZURE_WEBAPP_PACKAGE_PATH_BACKEND }}
npm install --legacy-peer-deps
npm run build --if-present
npm run test --if-present
- name: Install, build, and test frontend
run: |
cd ${{ env.AZURE_WEBAPP_PACKAGE_PATH_FRONTEND }}
npm install --legacy-peer-deps
npm run build --if-present
npm run test --if-present
- name: Upload backend artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: backend-app
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_BACKEND }}
- name: Upload frontend artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: frontend-app
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_FRONTEND }}
deploy-backend:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
environment:
name: 'Development'
url: ${{ steps.deploy-to-webapp-backend.outputs.webapp-url }}
steps:
- name: Download backend artifact from build job
uses: actions/download-artifact@v3
with:
name: backend-app
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_BACKEND }}
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Deploy backend to Azure WebApp'
id: deploy-to-webapp-backend
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME_BACKEND }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_BACKEND }}
deploy-frontend:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
environment:
name: 'Development'
url: ${{ steps.deploy-to-webapp-frontend.outputs.webapp-url }}
steps:
- name: Download frontend artifact from build job
uses: actions/download-artifact@v3
with:
name: frontend-app
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_FRONTEND }}
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Deploy frontend to Azure WebApp'
id: deploy-to-webapp-frontend
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME_FRONTEND }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH_FRONTEND }}