chore: update packages #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow for our node.js 20 app does the following: | |
# - run tests | |
# - build the app | |
# - login to Azure with AZURE_CREDENTIALS github secret | |
# - run Azure CLI command to deploy | |
name: Deploy to Azure | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
- name: Build | |
run: npm run build | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Deploy to Azure | |
run: | | |
# Create resource group rg-copilot-nodejs-todo | |
az group create --name rg-copilot-nodejs-todo --location eastus | |
# Create cosmosdb with default api | |
az cosmosdb create --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo | |
# Create database todos with collection tasks | |
az cosmosdb sql database create --account-name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --name todos | |
az cosmosdb sql container create --account-name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --database-name todos --name tasks --partition-key-path /_partitionKey --throughput 400 | |
# Deploy webapp using node 20 | |
az webapp up --sku F1 --name nodejs-todo-sinedied2 --resource-group rg-copilot-nodejs-todo --runtime "node|20-lts" | |
# Retrieve cosmos endpoint | |
cosmos_endpoint=$(az cosmosdb show --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --query documentEndpoint --output tsv) | |
# Retrieve cosmos key | |
cosmos_key=$(az cosmosdb keys list --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --query primaryMasterKey --output tsv) | |
# Set cosmos variables in web app | |
az webapp config appsettings set --name nodejs-todo-sinedied2 --resource-group rg-copilot-nodejs-todo --settings COSMOS_ENDPOINT=$cosmos_endpoint COSMOS_KEY=$cosmos_key --output none | |