forked from dalyIsaac/Whim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-Channel.ps1
28 lines (24 loc) · 692 Bytes
/
Get-Channel.ps1
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
<#
.SYNOPSIS
Gets the current channel for the running GitHub Actions workflow.
This will not work if you are not running a GitHub Actions workflow.
#>
$channel = $null
$isPrerelease = $true
if ($env:GITHUB_REF -eq "refs/heads/main") {
$channel = "alpha"
}
elseif ($env:GITHUB_REF.StartsWith("refs/heads/release/")) {
$channel = "beta"
}
elseif ($env:GITHUB_REF.StartsWith("refs/tags/")) {
$channel = "stable"
$isPrerelease = $false
}
else {
throw "Unsupported ref: $env:GITHUB_REF"
}
$isPrerelease = $isPrerelease.ToString().ToLower()
"channel=${channel}" >> $env:GITHUB_ENV
"isPrerelease=${isPrerelease}" >> $env:GITHUB_ENV
return $channel, $isPrerelease