Skip to content

Commit

Permalink
Update main_519webnode.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Naserien authored Mar 27, 2024
1 parent c487349 commit d75ff69
Showing 1 changed file with 53 additions and 50 deletions.
103 changes: 53 additions & 50 deletions .github/workflows/main_519webnode.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,76 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - 519webnode
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy ASP.Net Core app to Azure Web App - 519web

# name: Build and deploy ASP.Net Core app to Azure Web App - ssign1

on:
push:
branches:
- main
paths:
paths:
- "Node/WEB/**"
workflow_dispatch:

env:
AZURE_WEBAPP_NAME: assign1node # set this to your application's name
WEBAPP_PACKAGE_PATH: 'Node/WEB' # set this to the path to your web app project, defaults to the repository root
FRONTEND_PACKAGE_PATH: 'Node/WEB/frontend' # 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
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'
- uses: actions/checkout@v3

- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
cache: 'npm'
cache-dependency-path: './Node/WEB/package.json'

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip
- name: npm install, build, and test
working-directory: '${{env.WEBAPP_PACKAGE_PATH}}'
run: |
npm install
- name: npm install react frontend
working-directory: './${{env.FRONTEND_PACKAGE_PATH}}'
run: |
npm install
npm run build
rm -r public
rm -r node_modules
rm -r src
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: .

deploy:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
name: 'Development'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

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: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_B9A30B2DE7944220A0998A7C483A3581 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B81A2E83968D4E368653CA39A535DD18 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_3280B369B0DA438AA85F3B174FBF30D0 }}

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: '519webnode'
slot-name: 'Production'
package: .

- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
- name: 'Deploy to Azure WebApp'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_ASSIGN1NODE }}
package: ${{ env.WEBAPP_PACKAGE_PATH }}

0 comments on commit d75ff69

Please sign in to comment.