Continuous deployment

You can automatically deploy all changes that you make to a fork of the nRF Asset Tracker for Azure.

Note

It is optional to keep the deployment in your Azure account automatically synchronized with your fork’s source code repository.

Fork the nRF Asset Tracker repositories

To enable continuous deployment, complete the following steps:

  1. Fork the nRF Asset Tracker for Azure repository.
  2. Fork the Cat Tracker web application repository.
  3. Update the deploy.webApp.repository in the package.json file of your nRF Asset Tracker for Azure fork. It must point to the repository URL of your fork of the Cat Tracker web application.

Acquire credentials for GitHub Actions

To acquire credentials for GitHub Actions, complete the following steps:

  1. Login using the shell:

    az login
    
  2. Export the identifier of the subscription which contains the nRF Asset Tracker resources:

    export SUBSCRIPTION_ID="subscription id"
    
  3. Make sure that you have enabled the correct subscription by running the following commands:

    az account set --subscription $SUBSCRIPTION_ID
    # Verify that it is set to default
    az account list --output table
    
  4. Create the CI credentials:

    az ad sp create-for-rbac --name 'https://nrfassettracker.invalid/cd' --role contributor \
       --scopes \
          "/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP:-nrfassettracker}" \
       --sdk-auth \
       > cd-credentials.json
    

Provide the credentials to GitHub Actions

  1. Add the following secrets to an environment called production in your fork of the nRF Asset Tracker for Azure:
    • AZURE_CREDENTIALS - Store the contents of the JSON file created in the above step.
  2. Add the following following values from your .envrc file as secrets as well:
    • RESOURCE_GROUP
    • LOCATION
    • APP_NAME
    • B2C_TENANT
    • APP_REG_CLIENT_ID
  3. If you have enabled the Unwired Labs Cell Geolocation, add your API key as a secret as well:
    • UNWIRED_LABS_API_KEY

Trigger a deployment

Commit a change to your fork to trigger a deployment.

Check the status of the continuous deployment

To check the status of the continuous deployment after making the changes, navigate to the Actions tab of your fork. You can see a workflow run of the Continuous Deployment action:

GitHub Actions workflow run of Continuous Deployment

GitHub Actions workflow run of Continuous Deployment