-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (45 loc) · 1.7 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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=2102613 -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"