Rediģēt

Kopīgot, izmantojot


AzureStaticWebApp@0 - Deploy Azure Static Web App v0 task

This task builds and deploys an Azure Static Web app.

Syntax

# Deploy Azure Static Web App v0
# Build and deploy an Azure Static Web App.
- task: AzureStaticWebApp@0
  inputs:
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd | rootDirectory. Working directory. Default: $(System.DefaultWorkingDirectory).
    #app_location: # string. App location. 
    #app_build_command: # string. App build command. 
    #output_location: # string. Output location. 
    #api_location: # string. Api location. 
    #api_build_command: # string. Api build command. 
    #routes_location: # string. Routes location. 
    #config_file_location: # string. Config file location. 
    #skip_app_build: # boolean. Skip app build. 
    #skip_api_build: # boolean. Skip api build. 
    #is_static_export: # boolean. Set static export. 
    #verbose: # boolean. Verbose. 
    #build_timeout_in_minutes: # string. Build timeout in minutes. 
    #azure_static_web_apps_api_token: # string. Azure Static Web Apps api token. 
    #deployment_environment: # string. Deployment Environment. 
    #production_branch: # string. Production Branch. 
    #data_api_location: # string. Data api location.
# Deploy Azure Static Web App v0
# Build and deploy an Azure Static Web App.
- task: AzureStaticWebApp@0
  inputs:
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd | rootDirectory. Working directory. Default: $(System.DefaultWorkingDirectory).
    #app_location: # string. App location. 
    #app_build_command: # string. App build command. 
    #output_location: # string. Output location. 
    #api_location: # string. Api location. 
    #api_build_command: # string. Api build command. 
    #routes_location: # string. Routes location. 
    #config_file_location: # string. Config file location. 
    #skip_app_build: # boolean. Skip app build. 
    #skip_api_build: # boolean. Skip api build. 
    #is_static_export: # boolean. Set static export. 
    #verbose: # boolean. Verbose. 
    #build_timeout_in_minutes: # string. Build timeout in minutes. 
    #azure_static_web_apps_api_token: # string. Azure Static Web Apps api token. 
    #deployment_environment: # string. Deployment Environment. 
    #production_branch: # string. Production Branch.

Inputs

workingDirectory - Working directory
Input alias: cwd | rootDirectory. string. Default value: $(System.DefaultWorkingDirectory).

Specifies the absolute working directory in which to execute this task. If left empty, the default working directory is used.


app_location - App location
string.

The directory location of the application source code, relative to the working directory. When used with skip_app_build: true, this value is the app's build output location.


app_build_command - App build command
string.

The custom command used to run Oryx when building application source code.


output_location - Output location
string.

The directory location of the compiled application code after building is complete, relative to the working directory. Set this an empty string ('') when bypassing automatic build and only deploy is required.


api_location - Api location
string.

The directory location of the Azure Functions source code, relative to the working directory.


api_build_command - Api build command
string.

The custom command used to run Oryx when building Azure Functions source code.


routes_location - Routes location
string.

The directory location of the routes.json file, relative to the working directory.
Note: Routes.json is deprecated. Use staticwebapp.config.json.


config_file_location - Config file location
string.

The directory location of the staticwebapp.config.json file, relative to the working directory.


skip_app_build - Skip app build
boolean.

Skips Oryx build for the app folder.


skip_api_build - Skip api build
boolean.

Skips Oryx build for the API folder.


is_static_export - Set static export
boolean.

Set this flag to true when your application is configured to export to static HTML, like when using next export.

When this flag is set to true


verbose - Verbose
boolean.

Enables verbose logging.


build_timeout_in_minutes - Build timeout in minutes
string.

Specifies the time limit of the Oryx app folder build in minutes.


azure_static_web_apps_api_token - Azure Static Web Apps api token
string.

Specifies the API token for deployment.
Note: Not required if passed as an environment variable.


deployment_environment - Deployment Environment
string.

Specifies the environment to deploy to. Leave blank for the production environment. This input takes precedence over the production branch.


production_branch - Production Branch
string.

Specifies the production branch. When defined, and the deployment environment is empty, deployments from other branches will be preview environments.


data_api_location - Data api location
string.

Directory location of the Data API source files relative to working directory.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Note

This task only runs on Linux agents.

Examples


trigger:
  - main

pool:
  vmImage: ubuntu-latest

steps:
  - checkout: self
    submodules: true
  - task: AzureStaticWebApp@0
    inputs:
      app_location: '/build'
      api_location: 'api'
      output_location: '/output'
      azure_static_web_apps_api_token: $(deployment_token)

Skip building front-end app and run only deploy


trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '20.x'
    displayName: 'Install Node.js'

  - script: |
      npm ci
      npm run build
    displayName: 'dependencies install and distribution build'

- task: AzureStaticWebApp@0
  inputs:
    app_location : '/dist'
    output_location: '' # Leave this empty
    skip_app_build: true
    skip_api_build: true
    azure_static_web_apps_api_token: $(deployment_token)

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.95.0 or greater
Task category Utility