Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edb1501f40 | |||
| 5854940f75 | |||
| 02f83e6633 | |||
| d4c7aa5a92 | |||
| 15381257e5 |
@@ -72,7 +72,7 @@ jobs:
|
|||||||
Set-Location -Path ${{ github.workspace }}
|
Set-Location -Path ${{ github.workspace }}
|
||||||
$moduleVersion = git describe --tags
|
$moduleVersion = git describe --tags
|
||||||
Write-Host "Module version: $moduleVersion"
|
Write-Host "Module version: $moduleVersion"
|
||||||
$module = get-childItem -path . -Directory -Exclude ".*" | Select-Object -ExpandProperty Name
|
$module = get-childItem -path . -Directory -Exclude (".*", "Tests") | Select-Object -ExpandProperty Name
|
||||||
Write-Host "Publishing module $module to Gitea"
|
Write-Host "Publishing module $module to Gitea"
|
||||||
Publish-Module -Path $module -Repository 'GiteaPublic' -NuGetApiKey "${{ secrets.PACKAGES_TOKEN }}"
|
Publish-Module -Path $module -Repository 'GiteaPublic' -NuGetApiKey "${{ secrets.PACKAGES_TOKEN }}"
|
||||||
Write-Host "Module $module published to Gitea"
|
Write-Host "Module $module published to Gitea"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
RootModule = 'PS-GiteaUtilities.psm1'
|
RootModule = 'PS-GiteaUtilities.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '1.4.0'
|
ModuleVersion = '1.4.4'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
@@ -69,7 +69,7 @@ PowerShellVersion = '5.1'
|
|||||||
# NestedModules = @()
|
# NestedModules = @()
|
||||||
|
|
||||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||||
FunctionsToExport = 'Set-GiteaConfiguration', 'Get-GiteaConfiguration', 'Get-GiteaFileContent', 'Invoke-GiteaFileDownload', 'Get-GiteaChildItem'
|
FunctionsToExport = 'Set-GiteaConfiguration', 'Get-GiteaConfiguration', 'Get-GiteaFileContent', 'Invoke-GiteaFileDownload', 'Get-GiteaChildItem', 'Get-GiteaReleases'
|
||||||
|
|
||||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||||
CmdletsToExport = '*'
|
CmdletsToExport = '*'
|
||||||
|
|||||||
@@ -410,8 +410,12 @@ Function Invoke-GiteaFileDownload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
|
# If type is not provided, check for any hints for cases such as LFS where a type can be inferred and special handling is needed
|
||||||
|
If($downloadURL -match "/api/v1/repos/[^/]+/[^/]+/media/") {
|
||||||
|
$type = "lfs"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Verbose "Type: $type"
|
Write-Verbose "Type: $type"
|
||||||
|
|
||||||
# Handle the type parameter
|
# Handle the type parameter
|
||||||
|
|
||||||
# Skip directories and provide a verbose message
|
# Skip directories and provide a verbose message
|
||||||
@@ -447,10 +451,18 @@ Function Invoke-GiteaFileDownload {
|
|||||||
# Separate the URL into its components: Gitea URL, Repo Owner, Repo Name, branch, file path, and file name
|
# Separate the URL into its components: Gitea URL, Repo Owner, Repo Name, branch, file path, and file name
|
||||||
$uri = New-Object System.Uri($downloadURL)
|
$uri = New-Object System.Uri($downloadURL)
|
||||||
$pathSegments = $uri.AbsolutePath.Trim('/').Split('/')
|
$pathSegments = $uri.AbsolutePath.Trim('/').Split('/')
|
||||||
# Everything after the branch + 1 segment is considered the file path with the last segment being the file name
|
If($type -eq "lfs") {
|
||||||
$branchIndex = [Array]::IndexOf($pathSegments, "branch") + 2
|
# Everything after the media segment is considered the file path with the last segment being the file name
|
||||||
$DownloadFilePath = $pathSegments[$branchIndex..($pathSegments.Length - 2)] -join '/'
|
$branchIndex = [Array]::IndexOf($pathSegments, "media") + 1
|
||||||
$DownloadFileName = $pathSegments[-1]
|
$DownloadFilePath = $pathSegments[$branchIndex..($pathSegments.Length - 2)] -join '/'
|
||||||
|
$DownloadFileName = $pathSegments[-1]
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
# Everything after the branch + 1 segment is considered the file path with the last segment being the file name
|
||||||
|
$branchIndex = [Array]::IndexOf($pathSegments, "branch") + 2
|
||||||
|
$DownloadFilePath = $pathSegments[$branchIndex..($pathSegments.Length - 2)] -join '/'
|
||||||
|
$DownloadFileName = $pathSegments[-1]
|
||||||
|
}
|
||||||
|
|
||||||
if ($PreserveRelativePath -and $outputPath) {
|
if ($PreserveRelativePath -and $outputPath) {
|
||||||
# If PreserveRelativePath is used, set up the directory structure
|
# If PreserveRelativePath is used, set up the directory structure
|
||||||
@@ -732,7 +744,7 @@ Function Get-GiteaChildItem {
|
|||||||
$item.size = [long]$matches[1]
|
$item.size = [long]$matches[1]
|
||||||
}
|
}
|
||||||
# Set the download URL to the media endpoint for LFS files to download the actual file
|
# Set the download URL to the media endpoint for LFS files to download the actual file
|
||||||
$item.download_url = "$giteaURL/api/v1/repos/$repoOwner/$repoName/media/$($item.path)"
|
$item.download_url = "$giteaURL/api/v1/repos/$repoOwner/$repoName/media/$($item.path)?ref=$branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemObj = [PSCustomObject]@{
|
$itemObj = [PSCustomObject]@{
|
||||||
@@ -1029,4 +1041,4 @@ function Get-GiteaReleases {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Export-ModuleMember -Function Set-GiteaConfiguration, Get-GiteaConfiguration, Get-GiteaFileContent, Invoke-GiteaFileDownload, Get-GiteaChildItem, Get-GiteaLFSFile, Get-GiteaReleases
|
# Export-ModuleMember -Function Set-GiteaConfiguration, Get-GiteaConfiguration, Get-GiteaFileContent, Invoke-GiteaFileDownload, Get-GiteaChildItem, Get-GiteaReleases
|
||||||
Reference in New Issue
Block a user