Skip to content

Commit

Permalink
Update deploy-client.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HlexNC authored Jun 12, 2024
1 parent e518907 commit dcf5eb9
Showing 1 changed file with 60 additions and 33 deletions.
93 changes: 60 additions & 33 deletions .github/workflows/deploy-client.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,70 @@
name: Deploy Client
name: Build and deploy Node.js app to Azure Web App - devablos-client

on:
push:
branches:
- feature/deployment-setup
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build-and-deploy:
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'

- name: Install dependencies and build client
run: |
cd client
npm install
npm run build
- name: Zip artifact for deployment
run: |
cd client/build
zip -r ../../release.zip .
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip

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

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
cd client
npm install
- name: Build project
run: |
cd client
npm run build || true
- name: Verify build directory
run: |
ls -al client/build
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: DevablosClientApp
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_CLIENT }}
package: client/build
- 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.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'devablos-client'
slot-name: 'production'
package: .

0 comments on commit dcf5eb9

Please sign in to comment.