Skip to content

Commit f882fed

Browse files
committed
CI: Generate v1 and v2 remote repositories side-by-side, update default repo URL
Updates the remote repository generator script to support a new `v2` format with bare manifests instead of archives. The remote repo is now generated with `v1` and `v2` side-by-side in subdirectories, with another copy of `v1` in the root of the repo for backwards compatibility. Also updates the default repository to a domain under my control, to avoid a hard dependency on GitHub.
1 parent cab829c commit f882fed

3 files changed

Lines changed: 29 additions & 16 deletions

File tree

.github/actions/build-pog-repository/build-remote-repo.ps1

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ if ($Validate) {
2424
}
2525
}
2626

27-
28-
$null = mkdir -Force $RemoteRepoDir
29-
cd $RemoteRepoDir
30-
31-
rm -Recurse *
27+
$OutDir = mkdir -Force $RemoteRepoDir
28+
rm -Recurse $OutDir\*
29+
$OutV1, $OutV2 = mkdir $OutDir\v1, $OutDir\v2
3230

3331
$Packages = [array][Pog.InternalState]::Repository.Enumerate()
3432

@@ -37,18 +35,23 @@ $Packages | % {
3735
$VersionMap[$_.PackageName] = @($_.EnumerateVersions() | % ToString)
3836
}
3937
# not really html, but whatever
40-
$VersionMap | ConvertTo-Json -Depth 100 -Compress > index.html
38+
$VersionMap | ConvertTo-Json -Depth 100 -Compress | Set-Content "$OutV1\index.html", "$OutV2\index.html"
4139

42-
# TODO: build in parallel
43-
$TmpPackage = New-PogPackage _zip_export
40+
$TmpPackage = New-PogPackage _remote_repo_zip_export
4441
try {
42+
# TODO: run in parallel
4543
$Packages | % {
46-
$null = mkdir $_.PackageName
44+
$null = mkdir "$OutV1\$($_.PackageName)"
45+
$null = mkdir "$OutV2\$($_.PackageName)"
46+
4747
$VersionCounter = 0
4848
$_.Enumerate() | % {
49-
$_.ImportTo($TmpPackage)
50-
Compress-Archive "$($TmpPackage.Path)\*" ".\$($_.PackageName)\$($_.Version).zip"
5149
$VersionCounter++
50+
# v1
51+
$_.ImportTo($TmpPackage)
52+
Compress-Archive "$($TmpPackage.Path)\*" "$OutV1\$($_.PackageName)\$($_.Version).zip"
53+
# v2
54+
Set-Content "$OutV2\$($_.PackageName)\$($_.Version).psd1" $_.Manifest -NoNewline
5255
}
5356

5457
[pscustomobject]@{
@@ -58,4 +61,8 @@ try {
5861
}
5962
} finally {
6063
rm -Force -Recurse $TmpPackage.Path
61-
}
64+
}
65+
66+
# copy over v1 to the root, older Pog versions expect to find the repo in the root
67+
# since packages are checked against the top-level listing, the `v1` and `v2` dirs should not be confused for packages
68+
cp -Recurse $OutV1\* $OutDir

.github/actions/install-pog/install-pog.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@ param(
33
[string]
44
$PogPath,
55
[Parameter(Mandatory)]
6-
[version]
6+
[string]
77
$Version
88
)
99

1010
Set-StrictMode -Version 3
1111
$ErrorActionPreference = "Stop"
1212
$PSNativeCommandUseErrorActionPreference = $true
1313

14+
$Tag = if ($Version -eq "nightly") {
15+
"nightly"
16+
} else {
17+
"v$([version]$Version)"
18+
}
19+
1420
$ArchivePath = "${PogPath}.zip"
15-
$ReleaseUrl = "https://github.com/MatejKafka/Pog/releases/download/v$Version/Pog-v$Version.zip"
21+
$ReleaseUrl = "https://github.com/MatejKafka/Pog/releases/download/$Tag/Pog-$Tag.zip"
1622

17-
Write-Host "Installing Pog v$Version from '$ReleaseUrl'..."
23+
Write-Host "Installing Pog $Tag from '$ReleaseUrl'..."
1824

1925
# download Pog
2026
iwr $ReleaseUrl -OutFile $ArchivePath

app/Pog/lib_compiled/Pog/src/Pog.PathConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static class PackagePaths {
6666
internal const string TmpDeleteDirName = ".POG_INTERNAL_delete_tmp";
6767
}
6868

69-
public const string DefaultRemoteRepositoryUrl = "https://matejkafka.github.io/PogPackages/";
69+
public const string DefaultRemoteRepositoryUrl = "https://packages.pog.matejkafka.com/v1/";
7070

7171
/// Path to the main Pog module to import.
7272
public readonly string MainModulePath;

0 commit comments

Comments
 (0)