简体   繁体   中英

Generate release notes and send via E-mail

I've created a release pipeline which generates release notes, and later publishes it on the Wiki.

Only issue i am having is that the Wiki cannot be updated, but rather a new Wiki pages/sub-page needs to be created manually each time. Due to this, i was wondering if there's anyway i can send my release notes to an email address instead?

my PowerShell

$content = [IO.File]::ReadAllText("$(System.DefaultWorkingDirectory)\releasenotes.md")
$data = @{content=$content;} | ConvertTo-Json;

$connectionToken= '[token]'

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))

$params = @{uri = '$(WikiPath)';
  Method = 'PUT';
  Headers = @{Authorization = "Basic $base64AuthInfo" };
  ContentType = "application/json";
  Body = $data;
}
Invoke-WebRequest @params

Any guide will be appreciated, quite new to all this.

This might depend on whether you're using a on-premises agent or a hosted agent as you will require access to an SMTP server from the agent your job is running. You can then simply use PowerShell to send your email:

Send-MailMessage -From $From -To $To -Subject $Subject -Body $Body -BodyAsHTML -SmtpServer $SmtpServer -Priority High -Encoding UTF8

Wes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM