Created
September 19, 2023 12:40
-
-
Save kzhen/a9f12dbc37165be3d2512ea0c6a475db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: | |
- main | |
stages: | |
- stage: 'GenerateHugo' | |
displayName: 'Generate hugo website' | |
jobs: | |
- job: | |
pool: | |
vmImage: ubuntu-latest | |
workspace: | |
clean: all | |
steps: | |
- checkout: self | |
displayName: 'Checkout repository including submodules' | |
submodules: true # true so Hugo theme submodule is checked out | |
- script: wget https://github.com/gohugoio/hugo/releases/download/v0.118.2/hugo_extended_0.118.2_linux-amd64.deb -O '$(Pipeline.Workspace)/hugo.deb' | |
displayName: Download Hugo | |
# 2. Installs Hugo executable | |
- script: sudo dpkg -i $(Pipeline.Workspace)/hugo*.deb | |
displayName: Install Hugo | |
- task: CmdLine@2 | |
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') | |
inputs: | |
script: | | |
hugo --destination $(Build.ArtifactStagingDirectory) | |
npx pagefind --site $(Build.ArtifactStagingDirectory) | |
- task: AzureStaticWebApp@0 | |
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') | |
inputs: | |
workingDirectory: '$(Build.ArtifactStagingDirectory)' | |
app_location: '/' | |
output_location: '/' | |
skip_app_build: true | |
skip_api_build: true | |
is_static_export: true | |
verbose: true | |
azure_static_web_apps_api_token: '$(TOKEN)' | |
- task: CmdLine@2 | |
condition: ne(variables['Build.SourceBranch'], 'refs/heads/main') | |
inputs: | |
script: | | |
hugo -D --destination $(Build.ArtifactStagingDirectory) | |
npx pagefind --site $(Build.ArtifactStagingDirectory) | |
- task: AzureStaticWebApp@0 | |
condition: ne(variables['Build.SourceBranch'], 'refs/heads/main') | |
inputs: | |
workingDirectory: '$(Build.ArtifactStagingDirectory)' | |
app_location: '/' | |
output_location: '/' | |
skip_app_build: true | |
skip_api_build: true | |
is_static_export: true | |
verbose: true | |
azure_static_web_apps_api_token: '$(STAGING_TOKEN)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment