Skip to content

Commit 7f3bb3c

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

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-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. Defaults to the latest available version.'
10+
required: false
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Install Pog
15+
shell: pwsh
16+
run: |
17+
& $env:GITHUB_ACTION_PATH\install-pog.ps1 $env:POG_PATH
18+
env:
19+
POG_PATH: ${{ inputs.path }}
20+
POG_VERSION: ${{ inputs.version }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
param(
2+
[Parameter(Mandatory)]
3+
[string]
4+
$PogPath,
5+
[version]
6+
$Version
7+
)
8+
9+
Set-StrictMode -Version 3
10+
$ErrorActionPreference = "Stop"
11+
$PSNativeCommandUseErrorActionPreference = $true
12+
13+
$ArchivePath = "${PogPath}.zip"
14+
15+
$Endpoint = if ($Version) {"tags/v$Version"} else {"latest"}
16+
$ReleaseUrl = (Invoke-RestMethod "https://api.github.com/repos/MatejKafka/Pog/releases/$Endpoint").assets.browser_download_url
17+
18+
Write-Host "Installing Pog from '$ReleaseUrl'..."
19+
iwr $ReleaseUrl -OutFile $ArchivePath
20+
21+
# unpack Pog, tar is much faster than Expand-Archive
22+
$null = mkdir $PogPath
23+
tar -xf $ArchivePath --directory $PogPath
24+
25+
# setup Pog
26+
& $PogPath\Pog\setup.ps1 -Enable None
27+
28+
# propagate PATH and PSModulePath for the following steps
29+
Add-Content $env:GITHUB_PATH (Resolve-Path $PogPath\Pog\data\package_bin)
30+
Add-Content $env:GITHUB_ENV "PSModulePath=$env:PSModulePath"

0 commit comments

Comments
 (0)