Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

chore(deps): update dependency @nordicsemiconductor/e2e-bdd-test-runn… #1876

chore(deps): update dependency @nordicsemiconductor/e2e-bdd-test-runn…

chore(deps): update dependency @nordicsemiconductor/e2e-bdd-test-runn… #1876

Workflow file for this run

name: Continuous Deployment
on:
workflow_dispatch:
push:
branches:
- saga
paths-ignore:
- Dockerfile
- .github/workflows/test-docker.yaml
- .github/workflows/publish-docker.yaml
- .github/workflows/test-and-release.yaml
permissions:
id-token: write
contents: write
issues: write
jobs:
deploy:
runs-on: ubuntu-22.04
environment:
name: production
url: ${{ steps.web-app-url.outputs.web_app_url }}
env:
APP_REG_CLIENT_ID: ${{ secrets.APP_REG_CLIENT_ID }}
LOCATION: ${{ secrets.LOCATION }}
APP_NAME: ${{ secrets.APP_NAME }}
STORAGE_ACCOUNT_NAME: ${{ secrets.STORAGE_ACCOUNT_NAME }}
B2C_TENANT: ${{ secrets.B2C_TENANT }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
NRF_CLOUD_TEAM_ID: ${{ secrets.NRF_CLOUD_TEAM_ID }}
NRF_CLOUD_SERVICE_KEY: ${{ secrets.NRF_CLOUD_SERVICE_KEY }}
outputs:
web_app_url: ${{ steps.web-app-url.outputs.web_app_url }}
steps:
- 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: List Azure Accounts
uses: azure/CLI@v1
with:
inlineScript: |
az account list --output table
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Keep npm cache around to speed up installs
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci --no-audit
- name: Compile source
run: npx tsc
- name: Set Key Vault name
run: |
echo "keyVaultName=${APP_NAME:-nrfassettracker}" >> $GITHUB_ENV
- name: Set nRF Cloud Location Service key
uses: azure/CLI@v1
with:
inlineScript: |
echo "${{ secrets.NRF_CLOUD_SERVICE_KEY }}" > nrfcloudservice.key
az keyvault secret set --vault-name ${{ env.keyVaultName }} --name nrfCloudServiceKey --file nrfcloudservice.key
rm nrfcloudservice.key
- name: Determine Version
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
TAG=`git tag --contains ${{ github.sha }} | tr -d '\n'`
VERSION=${TAG:-${{ github.sha }}}
echo Version: ${VERSION}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Deploy solution
uses: azure/CLI@v1
with:
inlineScript: |
az deployment group create \
--resource-group ${{ env.RESOURCE_GROUP }} \
--mode Complete \
--name cd-${{ env.VERSION }} \
--template-file azuredeploy.json \
--parameters \
appName=${APP_NAME:-nrfassettracker} \
storageAccountName=${{ env.STORAGE_ACCOUNT_NAME }} \
appRegistrationClientId=${{ env.APP_REG_CLIENT_ID }} \
b2cTenant=${{ env.B2C_TENANT }} \
nrfCloudTeamId=${{ env.NRF_CLOUD_TEAM_ID }} \
keyVaultName=${{ env.keyVaultName }}
- name: Pack Function App
run: node scripts/pack-app.js
- name: Deploy Function App
uses: azure/CLI@v1
with:
inlineScript: |
az functionapp deployment source config-zip -g ${{ env.RESOURCE_GROUP }} -n ${APP_NAME:-nrfassettracker}api --src dist/functionapp.zip
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: functionapp-${{ github.sha }}
path: dist/functionapp.zip
- name: Enable static site hosting for the app
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob service-properties update --account-name ${{ env.STORAGE_ACCOUNT_NAME }} --static-website --404-document index.html --index-document index.html
- name: Determine Web App settings
run: ./cli.sh react-config >> $GITHUB_ENV
- name: Determine public URL
id: web-app-url
uses: azure/CLI@v1
with:
inlineScript: |
PUBLIC_URL=`az storage account show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.STORAGE_ACCOUNT_NAME }} --query 'primaryEndpoints.web' --output tsv | tr -d '\n'`
echo "web_app_url=${PUBLIC_URL}" >> $GITHUB_OUTPUT
echo "PUBLIC_URL=${PUBLIC_URL}" >> $GITHUB_ENV
- name: Build app
run: |
export EXTEND_ESLINT=true
WEBAPP_REPO=`cat package.json | jq -r '.deploy.webApp.repository'`
WEBAPP_BRANCH=`cat package.json | jq -r '.deploy.webApp.branch'`
git clone --branch $WEBAPP_BRANCH --single-branch $WEBAPP_REPO app
cd app
git fetch --tags
export REACT_APP_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $REACT_APP_VERSION
npm ci --no-audit
npm run build
- name: Deploy Web App
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --account-name ${{ env.STORAGE_ACCOUNT_NAME }} --overwrite -s ./app/build -d '$web'