Azure
Zero Config Provider
Integration with this provider is possible with zero configuration. (Learn More)
Azure Static Web Apps are designed to be deployed continuously in a . By default, Nitro will detect this deployment environment and enable the azure
preset.
You can invoke a development environment to preview before deploying.
Deploy from CI/CD via GitHub Actions
When you link your GitHub repository to Azure Static Web Apps, a workflow file is added to the repository.
If you miss this step, you can always find the build configuration section in your workflow and update the build configuration:
# .github/workflows/azure-static-web-apps-<RANDOM_NAME>.yml
###### Repository/Build Configurations ######
app_location: '/'
api_location: '.output/server'
output_location: '.output/public'
###### End of Repository/Build Configurations ######
Note: Pending an update in the , you will also need to run the following in your root directory:
That’s it! Now Azure Static Web Apps will automatically deploy your Nitro-powered application on push.
Azure Functions
Preset: azure-functions
Note: If you encounter any issues, please ensure you’re using a Node.js 14+ runtime. You can find more information about .
You can invoke a development environment from the serverless directory.
NITRO_PRESET=azure-functions yarn build
cd .output
func start
You can now visit http://localhost:7071/
in your browser and browse your site running locally on Azure Functions.
Deploy from your local machine
To deploy, just run the following command:
First, obtain your Azure Functions Publish Profile and add it as a secret to your GitHub repository settings following .
Then create the following file as a workflow:
# .github/workflows/azure.yml
name: azure
on:
push:
- main
pull_request:
- main
jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node: [ 14 ]
steps:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Checkout
uses: actions/checkout@master
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-azure
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
- name: Build
run: npm run build
env:
NITRO_PRESET: azure-functions
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
with:
app-name: <your-app-name>