Azure / Azure/static-web-apps

More docs on how to build and pack static web app as artifact without deploying

Open
#1,080 1 comment 3 reactions 1 assignee Claimed by @Reshmi-Sriram View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Would be great to have more documentation on how to handle build process separated from deployment/release process.

In Azure DevOps the most common flow is to have build pipelines that pack the build into an artifact to be later on deployed with a release pipeline.

I have made more than 40 trial with no success to achieve a non-static **build** pipeline with nextjs 13 and server side rendering to be packed as an artifact in Azure DevOps. The goal is that a **release** pipeline picks up the artifact afterwards and deploys de SWA in Azure with a deployment token. This will allow releasing previous builds as they are packed into an artifact.

After so many trials this is the current state of my yaml build pipeline.

```yaml
trigger:
branches:
include:
- master

pool:
name: Azure Pipelines
demands: npm

variables:
- name: CYPRESS_INSTALL_BINARY
value: 0
- name: SKIP_DEPLOY_ON_MISSING_SECRETS
value: true
- name: publishDirectory
value: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)'

steps:
- task: Npm@1
inputs:
command: 'install'
displayName: 'npm install'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'run-script build-prod'
displayName: 'npm build-prod'

- task: AzureStaticWebApp@0
inputs:
app_location: './.next'
api_location: './api'
app_build_command: 'rm -rf $SOURCE_DIR/node_modules/@next/swc-* && rm -rf $SOURCE_DIR/.next/cache'
config_file_location: '/'
skip_app_build: true
output_location: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)'
verbose: true

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(publishDirectory)'
ArtifactName: 'drop'

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.