Skip to content

Commit 747e35c

Browse files
author
Soham Dasgupta
committed
build: add conditional check for env var
1 parent 2c40d95 commit 747e35c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

polygon.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
$cwd = (Get-Location).Path;
22

3+
# Check for environment variable GITHUB_REF.
4+
$latestTag = if (-not (Test-Path -Path "Variable:\GITHUB_REF")) {
5+
(git describe --tags --abbrev=0);
6+
} else {
7+
$env:GITHUB_REF
8+
}
9+
310
# Get the latest version from tag
4-
git pull origin main;
5-
$latestTag = git describe --tags --abbrev=0;
611
$versionNumber = (Select-String -Pattern "\d+\.\d+\.\d+" -InputObject $latestTag).Matches[0].Value
712

813
Write-Host "Building Polygon version $versionNumber" -ForegroundColor Green;

0 commit comments

Comments
 (0)