Skip to content

Commit

Permalink
Updated workflows to deploy to Azure
Browse files Browse the repository at this point in the history
  • Loading branch information
anjanak13 committed Dec 23, 2024
1 parent 0559200 commit b4c1cac
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
82 changes: 82 additions & 0 deletions .github/workflows/main_race.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 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 - Race

on:
push:
branches:
- main
workflow_dispatch:

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: '20.x'

- name: npm install, build, and test
run: |
npm install
- name: Create Firebase service account file
env:
FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
run: |
mkdir -p env
echo "$FIREBASE_SERVICE_ACCOUNT" > env/impinjrfid.json
- name: Create .env file
run: |
echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env
echo GMAIL_USER=${{ secrets.GMAIL_USER }} >> .env
echo GMAIL_PASS=${{ secrets.GMAIL_PASS }} >> .env
- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
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: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8A90312F0932446BB07DD766F66B54DF }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_C4C22A37C00D4290909D077974D49245 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B24423AB7D2F4102B62AAF52F12B0E14 }}

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand All @@ -22,4 +23,4 @@
"passport": "^0.7.0",
"passport-local": "^1.0.0"
}
}
}

0 comments on commit b4c1cac

Please sign in to comment.