Skip to content

Commit a6d31fd

Browse files
committed
CI: Publish a GitHub Action to install Pog to a pipeline
1 parent 287fc81 commit a6d31fd

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Install Pog'
2+
description: 'Install the Pog package manager (https://github.com/MatejKafka/Pog).'
3+
inputs:
4+
path:
5+
description: 'Path to the directory where Pog is installed.'
6+
required: false
7+
default: D:\Pog
8+
version:
9+
description: 'Pog version to install. By default, downloads the version matching this GitHub Action ref.'
10+
required: false
11+
default: 0.12.0
12+
runs:
13+
using: "composite"
14+
steps:
15+
- shell: pwsh
16+
run: |
17+
& $env:GITHUB_ACTION_PATH\install-pog.ps1 $env:POG_PATH $env:POG_VERSION
18+
env:
19+
POG_PATH: ${{ inputs.path }}
20+
POG_VERSION: ${{ inputs.version }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
param(
2+
[Parameter(Mandatory)]
3+
[string]
4+
$PogPath,
5+
[Parameter(Mandatory)]
6+
[version]
7+
$Version
8+
)
9+
10+
Set-StrictMode -Version 3
11+
$ErrorActionPreference = "Stop"
12+
$PSNativeCommandUseErrorActionPreference = $true
13+
14+
$ArchivePath = "${PogPath}.zip"
15+
$ReleaseUrl = "https://github.com/MatejKafka/Pog/releases/download/v$Version/Pog-v$Version.zip"
16+
17+
Write-Host "Installing Pog v$Version from '$ReleaseUrl'..."
18+
19+
# download Pog
20+
iwr $ReleaseUrl -OutFile $ArchivePath
21+
22+
# unpack Pog, tar is much faster than Expand-Archive
23+
$null = mkdir $PogPath
24+
tar -xf $ArchivePath --directory $PogPath
25+
26+
# setup Pog
27+
& $PogPath\Pog\setup.ps1 -Enable None
28+
29+
# propagate PATH and PSModulePath for the following steps
30+
Add-Content $env:GITHUB_PATH (Resolve-Path $PogPath\Pog\data\package_bin)
31+
Add-Content $env:GITHUB_ENV "PSModulePath=$env:PSModulePath"

app/Pog/_scripts/release/build-release.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ try {
4343

4444
cd ./Pog
4545

46+
# need to store this one before we delete it
47+
$GhActionYaml = Get-Content -Raw ./.github/actions/install-pog/action.yml
48+
4649
rm -Recurse @(
4750
".github"
4851
".gitignore"
@@ -67,6 +70,14 @@ try {
6770
$PogPackageVersion = (Import-PowerShellDataFile ./pog.psd1).Version
6871
$PogDllVersion = (Get-Item ./app/Pog/lib_compiled/Pog.dll).VersionInfo.ProductVersion
6972

73+
if ($GhActionYaml -notmatch "\s+default: (\d+\.\d+\.\d+)`n") {
74+
throw "Could not parse 'install-pog' GitHub Action Pog version."
75+
}
76+
77+
if ([version]$Matches[1] -ne $Version) {
78+
throw "GitHub Action Pog download version does not match."
79+
}
80+
7081
if ($PogPSModuleVersion -ne $Version) {
7182
throw "Pog.psd1 PS module version does not match."
7283
}

0 commit comments

Comments
 (0)