Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (83 sloc) 3.1 KB
resources:
- repo: self
clean: true
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- azure-pipelines-sync-hostfile.yml
schedules:
- cron: "0 17 * * Fri"
always: true
displayName: Weekly build
branches:
include:
- master
stages:
- stage: build
jobs:
- job: build
pool:
vmImage: 'windows-latest'
steps:
- checkout: self
- task: DownloadPipelineArtifact@1
displayName: 'Download ssgen'
inputs:
buildType: specific
project: 'Opensource'
# StaticSiteGenerator
pipeline: 29
artifactName: ssgen
itemPattern: '**/ssgen.exe'
downloadPath: '$(Build.SourcesDirectory)'
- script: '"$(Build.SourcesDirectory)/ssgen.exe" --generate "$(Build.SourcesDirectory)/content"'
displayName: 'Gen wwwroot'
- script: |
xcopy "$(Build.SourcesDirectory)/content/wwwroot" "$(build.artifactstagingdirectory)/marcstan.net" /S /Y /I
displayName: Copy content
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: marcstan.net'
inputs:
targetPath: '$(build.artifactstagingdirectory)/marcstan.net'
ArtifactName: 'marcstan.net'
- stage: release
jobs:
- job: web
pool:
vmImage: 'windows-latest'
variables:
- group: 'Deployment Credentials'
- name: PackageFolder
value: '$(System.ArtifactsDirectory)/marcstan.net'
- name: ResourceGroupName
value: 'marcstan'
steps:
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'marcstan.net'
targetPath: '$(System.ArtifactsDirectory)/marcstan.net'
# sync requires azcopy v10
# AzCopy task does not support v10 (and sync) yet https://github.com/Microsoft/azure-pipelines-tasks/issues/9157
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile $(System.ArtifactsDirectory)/azcopy.zip
Expand-Archive -Path $(System.ArtifactsDirectory)/azcopy.zip -DestinationPath $(System.ArtifactsDirectory)/azcopy
Copy-item (Get-ChildItem -Path "$(System.ArtifactsDirectory)/azcopy" -Recurse | where { $_.Name -eq "azcopy.exe" } | select -First 1).FullName $(System.ArtifactsDirectory)/azcopy.exe
- script: |
set AZCOPY_SPA_CLIENT_SECRET=$(OpensourceDeploymentsClientSecret)
azcopy login --service-principal --application-id $(OpensourceDeploymentsClientId) --tenant-id=$(TenantId)
azcopy copy "https://hostmerger.blob.core.windows.net/config/hosts.txt" $(System.ArtifactsDirectory)\marcstan.net\hosts.txt
azcopy sync $(System.ArtifactsDirectory)\marcstan.net "https://$(ResourceGroupName).blob.core.windows.net/$web/" --delete-destination true
workingDirectory: '$(System.ArtifactsDirectory)'
displayName: 'Sync website'
- task: AzureCLI@1
inputs:
azureSubscription: 'Opensource Deployments'
scriptLocation: 'inlineScript'
inlineScript: 'az cdn endpoint purge -g $(ResourceGroupName) -n $(ResourceGroupName) --profile-name $(ResourceGroupName) --content-paths "/*"'
You can’t perform that action at this time.