mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
npx
This commit is contained in:
79
.github/workflows/dev_syncrow(dev).yml
vendored
79
.github/workflows/dev_syncrow(dev).yml
vendored
@ -1,7 +1,4 @@
|
|||||||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
|
name: Auth and Backend using Docker to Azure App Service
|
||||||
# More GitHub Actions for Azure: https://github.com/Azure/actions
|
|
||||||
|
|
||||||
name: Build and deploy Node.js app to Azure Web App - syncrow
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -9,63 +6,53 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
AZURE_WEB_APP_NAME: 'syncrow'
|
||||||
|
AZURE_WEB_APP_SLOT_NAME: 'dev'
|
||||||
|
ACR_REGISTRY: 'syncrow.azurecr.io'
|
||||||
|
IMAGE_NAME: 'backend'
|
||||||
|
IMAGE_TAG: 'latest'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_and_deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Node.js version
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20.x'
|
node-version: '20'
|
||||||
|
|
||||||
- name: npm install, build, and test
|
- name: Install dependencies and build project
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm run build --if-present
|
npm run build
|
||||||
npm run test --if-present
|
|
||||||
|
|
||||||
- name: Zip artifact for deployment
|
- name: List build output
|
||||||
run: zip release.zip ./* -r
|
run: ls -R dist/apps/
|
||||||
|
|
||||||
- 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: 'dev'
|
|
||||||
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: Log in to Azure
|
- name: Log in to Azure
|
||||||
uses: azure/login@v1
|
uses: azure/login@v1
|
||||||
with:
|
with:
|
||||||
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_BC1CF8CCEBC14B44B009FB9557BAD1A8 }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_7A710FEDFC48473BA2E60430D22C994D }}
|
|
||||||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_C599EA05F8D4418FB72503DC7D7F88A2 }}
|
|
||||||
|
|
||||||
- name: 'Deploy to Azure Web App'
|
- name: Log in to Azure Container Registry
|
||||||
id: deploy-to-webapp
|
run: az acr login --name ${{ env.ACR_REGISTRY }}
|
||||||
uses: azure/webapps-deploy@v2
|
|
||||||
with:
|
|
||||||
app-name: 'syncrow'
|
|
||||||
slot-name: 'dev'
|
|
||||||
package: .
|
|
||||||
|
|
||||||
|
- name: List build output
|
||||||
|
run: ls -R dist/apps/
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
run: |
|
||||||
|
docker build . -t ${{ env.ACR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
|
||||||
|
docker push ${{ env.ACR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
|
||||||
|
|
||||||
|
- name: Set Web App with Docker container
|
||||||
|
run: |
|
||||||
|
az webapp config container set \
|
||||||
|
--name ${{ env.AZURE_WEB_APP_NAME }} \
|
||||||
|
--resource-group backend \
|
||||||
|
--docker-custom-image-name ${{ env.ACR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
|
||||||
|
--docker-registry-server-url https://${{ env.ACR_REGISTRY }}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nest build",
|
"build": "npx nest build",
|
||||||
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
|
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
|
||||||
"start": "npx nest start",
|
"start": "npx nest start",
|
||||||
"start:dev": "npx nest start --watch",
|
"start:dev": "npx nest start --watch",
|
||||||
|
Reference in New Issue
Block a user