Skip to content

Commit dbf2f3c

Browse files
committed
11.0.0 :增加 maven central 上传脚本
1 parent 751df73 commit dbf2f3c

File tree

2 files changed

+113
-2
lines changed

2 files changed

+113
-2
lines changed

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ android.injected.testOnly=false
55
android.useAndroidX=true
66
android.enableJetifier=true
77

8-
PROJ_GROUP=com.shuyu
9-
PROJ_VERSION=10.2.1
8+
#PROJ_GROUP=com.shuyu
9+
PROJ_GROUP=io.github.carguo
10+
PROJ_VERSION=11.0.0
1011
PROJ_WEBSITEURL=https://github.com/CarGuo/GSYVideoPlayer
1112
PROJ_ISSUETRACKERURL=https://github.com/CarGuo/GSYVideoPlayer/issues
1213
PROJ_VCSURL=https://github.com/CarGuo/GSYVideoPlayer.git

mc.ps1

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Check if base directory, version number, package name, and regex pattern are provided
2+
param (
3+
[Parameter(Mandatory=$true)]
4+
[string]$BaseDir,
5+
[Parameter(Mandatory=$true)]
6+
[string]$Version,
7+
[Parameter(Mandatory=$true)]
8+
[string]$PackageName,
9+
[Parameter(Mandatory=$true)]
10+
[string]$RegexPattern
11+
)
12+
13+
# Get all directories in BaseDir that match the regex pattern
14+
$matchingDirs = Get-ChildItem -Path $BaseDir -Directory | Where-Object { $_.Name -match "^$RegexPattern" }
15+
16+
if ($matchingDirs.Count -eq 0) {
17+
Write-Error "No directories in $BaseDir match the pattern '$RegexPattern'"
18+
exit 1
19+
}
20+
21+
# Process each matching directory
22+
foreach ($dir in $matchingDirs) {
23+
$currentBaseDir = $dir.FullName
24+
$TargetDir = Join-Path $currentBaseDir $Version
25+
26+
# Check if target directory exists
27+
if (-not (Test-Path $TargetDir -PathType Container)) {
28+
Write-Warning "Directory $TargetDir does not exist, skipping"
29+
continue
30+
}
31+
32+
# Delete maven-metadata-local.xml from currentBaseDir if it exists
33+
$mavenFile = Join-Path $currentBaseDir "maven-metadata-local.xml"
34+
if (Test-Path $mavenFile) {
35+
Remove-Item $mavenFile
36+
Write-Host "Deleted $mavenFile"
37+
}
38+
39+
# Change to target directory
40+
Set-Location $TargetDir
41+
42+
# Process each file in the directory
43+
Get-ChildItem -File | Where-Object { $_.Extension -notin @('.asc', '.md5', '.sha1') } | ForEach-Object {
44+
$file = $_.Name
45+
46+
# Generate GPG signature
47+
gpg -ab $file
48+
49+
# Generate MD5 checksum (only the hash)
50+
$md5 = Get-FileHash -Algorithm MD5 $file
51+
$md5.Hash.ToLower() | Out-File "$file.md5" -Encoding ASCII
52+
53+
# Generate SHA1 checksum (only the hash)
54+
$sha1 = Get-FileHash -Algorithm SHA1 $file
55+
$sha1.Hash.ToLower() | Out-File "$file.sha1" -Encoding ASCII
56+
57+
Write-Host "Processed: $file in $TargetDir"
58+
}
59+
60+
# Create output directory with timestamp and currentBaseDir's last part
61+
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
62+
$baseDirLastPart = Split-Path $currentBaseDir -Leaf
63+
$outputDirName = "${timestamp}_${baseDirLastPart}"
64+
$parentDir = Split-Path $currentBaseDir -Parent
65+
$outputDir = Join-Path $parentDir $outputDirName
66+
67+
# Convert package name to directory structure (e.g., io.github.carguo to io\github\carguo)
68+
$packagePath = $PackageName.Replace('.', '\')
69+
70+
# Construct the final output path step-by-step
71+
$finalOutputPath = Join-Path $outputDir $packagePath
72+
$finalOutputPath = Join-Path $finalOutputPath $baseDirLastPart
73+
$finalOutputPath = Join-Path $finalOutputPath $Version
74+
75+
# Validate finalOutputPath
76+
if (-not $finalOutputPath) {
77+
Write-Error "Failed to construct final output path for $currentBaseDir"
78+
continue
79+
}
80+
81+
# Check if source and destination are the same
82+
if ($TargetDir -eq $finalOutputPath) {
83+
Write-Error "Source and destination directories are the same: $TargetDir"
84+
continue
85+
}
86+
87+
# Create the output directory structure
88+
New-Item -ItemType Directory -Path $finalOutputPath -Force | Out-Null
89+
Write-Host "Created output directory: $finalOutputPath"
90+
91+
# Copy all contents from TargetDir to the final output path
92+
Copy-Item -Path "$TargetDir\*" -Destination $finalOutputPath -Recurse -Force
93+
Write-Host "Copied contents to $finalOutputPath"
94+
95+
# Compress the 'io' directory inside the output directory into a ZIP file
96+
$ioDir = Join-Path $outputDir "io"
97+
$zipFilePath = Join-Path $parentDir "${outputDirName}.zip"
98+
if (-not (Test-Path $ioDir -PathType Container)) {
99+
Write-Error "Directory $ioDir does not exist"
100+
continue
101+
}
102+
Compress-Archive -Path $ioDir -DestinationPath $zipFilePath -Force
103+
Write-Host "Compressed contents of $ioDir to $zipFilePath"
104+
105+
# Delete the output directory after compression
106+
Remove-Item -Path $outputDir -Recurse -Force
107+
Write-Host "Deleted output directory: $outputDir"
108+
}
109+
110+
Write-Host "Processing completed for all matching directories"

0 commit comments

Comments
 (0)