Skip to content

Power-Automate-Desktop-Release #36

Power-Automate-Desktop-Release

Power-Automate-Desktop-Release #36

Workflow file for this run

name: Power-Automate-Desktop-Release
on:
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: windows-latest
steps:
- name: Release
run: |
# Download Power Automate for desktop
$fileName = "Setup.Microsoft.PowerAutomate.exe"
Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2164365 -OutFile $fileName
$version = $((Get-Item $fileName).VersionInfo.ProductVersion)
# Create GitHub release
$token = "${{ secrets.GITHUB_TOKEN }}"
$apiUrl = "https://api.github.com/repos/jfevia/Power-Automate-Desktop/releases"
$headers = @{
"Accept" = "application/vnd.github+json"
"Authorization" = "Bearer $token"
"X-GitHub-Api-Version" = "2022-11-28"
}
$tag = "v$version"
$body = @{
tag_name = "$tag"
target_commitish = "main"
name = "$version"
body = ""
draft = $false
prerelease = $false
generate_release_notes = $false
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $body
$releaseId = $response.id
# Create GitHub release asset
$apiUrl = "https://uploads.github.com/repos/jfevia/Power-Automate-Desktop/releases/$releaseId/assets?name=$fileName"
$headers = @{
"Accept" = "application/vnd.github+json"
"Authorization" = "Bearer $token"
"X-GitHub-Api-Version" = "2022-11-28"
"Content-Type" = "application/octet-stream"
}
Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -InFile "$fileName"