Skip to content

Instantly share code, notes, and snippets.

@dombarnes
Created April 6, 2023 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dombarnes/2253f95ff9184a6bac881484c734d625 to your computer and use it in GitHub Desktop.
Save dombarnes/2253f95ff9184a6bac881484c734d625 to your computer and use it in GitHub Desktop.
Azure DevOps Pipeline for deploying NuxtJS 3 to Azure Static Web Apps
# Node.js with Vue
# Build a Node.js project that uses Vue.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- main
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: BuildProductionAssets
displayName: 'Build production distritbution assets'
jobs:
- job: LintCheck
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- script: yarn install
displayName: 'yarn'
- script: yarn lint
displayName: 'yarn lint'
- deployment: StagingDeployment
displayName: 'Deployment to staging slot on Azure Static Web Apps'
environment: 'production'
condition: eq(variables.isMain, 'true')
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: AzureStaticWebApp@0
inputs:
# workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd | rootDirectory. Working directory. Default: $(System.DefaultWorkingDirectory).
app_location: '/' # string. App location.
app_build_command: 'NITRO_PRESET=azure yarn build' # string. App build command.
output_location: '.output/public' # string. Output location.
api_build_command: 'NITRO_PRESET=azure-functions yarn build' # string. Api build command.
api_location: '.output/server' # string. Api location.
# routes_location: # string. Routes location.
# config_file_location: # string. Config file location.
# skip_app_build: # boolean. Skip app build.
skip_api_build: true # boolean. Skip api build.
# is_static_export: # boolean. Set static export.
verbose: true # boolean. Verbose.
# build_timeout_in_minutes: # string. Build timeout in minutes.
azure_static_web_apps_api_token: $(deployment_token) # string. Azure Static Web Apps api token.
# deployment_environment: # string. Deployment Environment.
# production_branch: # string. Production Branch.
- publish: $(System.DefaultWorkingDirectory)/.output
artifact: WebApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment