Skip to content

Commit aaab2d8

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

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
- name: Install Pog
16+
shell: pwsh
17+
run: |
18+
& $env:GITHUB_ACTION_PATH\install-pog.ps1 $env:POG_PATH
19+
env:
20+
POG_PATH: ${{ inputs.path }}
21+
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"

0 commit comments

Comments
 (0)