Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save odenijs/a7e88e51f1efb180a99f75f9681bd496 to your computer and use it in GitHub Desktop.
Save odenijs/a7e88e51f1efb180a99f75f9681bd496 to your computer and use it in GitHub Desktop.
mkdocs Azure DevOps pipeline
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'windows-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
addToPath: true
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- script: pip install mkdocs-material
displayName: Install MkDocs Material Theme
- script: |
pip install mkdocs
mkdocs build
displayName: Install the MkDocs + build
- task: AzureFileCopy@4
inputs:
SourcePath: 'site/*'
azureSubscription: 'Pay-As-You-Go(54cd7785-8bb1-4bf4-86f1-bd2edfce207e)'
Destination: 'AzureBlob'
storage: 'imkarlme'
ContainerName: '$web'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
#Embed with title, description, and color
#Store webhook url
$webHookUrl = 'https://discordapp.com/api/webhooks/686941311894552616/I2RuCuRyk1Lk9ppjUjDpFAkWEICqWrvF1p7Izu2lhSEIC-c_DkV_Au3pHx7akIJpIGyb'
#Create embed array
[System.Collections.ArrayList]$embedArray = @()
#Store embed values
$title = 'wiki.imkarl.me'
$description = 'Pipeline has completed successfully!'
$color = '445734'
#Create embed object
$embedObject = [PSCustomObject]@{
title = $title
description = $description
color = $color
}
#Add embed object to array
$embedArray.Add($embedObject) | Out-Null
#Create the payload
$payload = [PSCustomObject]@{
embeds = $embedArray
}
#Send over payload, converting it to JSON
Invoke-RestMethod -Uri $webHookUrl -Body ($payload | ConvertTo-Json -Depth 4) -Method Post -ContentType 'application/json'
displayName: Discord Notification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment