Skip to content

Commit 7aafa0f

Browse files
committed
Added supporting files.
1 parent ae25ea4 commit 7aafa0f

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

Build-Packages.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Check if the dist directory exists and remove it
2+
if (Test-Path -Path "dist" -PathType Container) {
3+
Write-Host "Removing existing dist directory..."
4+
Remove-Item -Recurse -Force "dist"
5+
} else {
6+
Write-Host "dist directory not found. Skipping removal."
7+
}
8+
9+
# Build the packages
10+
Write-Host "Building packages..."
11+
uv build
12+
13+
Write-Host "Build process completed."

Publish-Packages.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Define the path to the .pypirc file
2+
$pypircPath = Join-Path $HOME ".pypirc"
3+
4+
# Initialize credential variables
5+
$pypiUsername = $null
6+
$pypiPassword = $null
7+
8+
# Check if the .pypirc file exists
9+
if (-not (Test-Path -Path $pypircPath -PathType Leaf)) {
10+
Write-Error "Error: ~/.pypirc file not found at '$pypircPath'."
11+
exit 1
12+
}
13+
14+
Write-Host "Reading credentials from $pypircPath..."
15+
16+
# Read the file content and parse for [pypi] credentials
17+
try {
18+
$pypircContent = Get-Content -Path $pypircPath -Raw
19+
# Simple parsing assuming [pypi] section and username/password lines
20+
if ($pypircContent -match '\[pypi\]') {
21+
if ($pypircContent -match '(?m)^\s*username\s*=\s*(.+)$') {
22+
$pypiUsername = $Matches[1].Trim()
23+
}
24+
if ($pypircContent -match '(?m)^\s*password\s*=\s*(.+)$') {
25+
$pypiPassword = $Matches[1].Trim()
26+
}
27+
}
28+
} catch {
29+
Write-Error "Error reading or parsing '$pypircPath': $($_.Exception.Message)"
30+
exit 1
31+
}
32+
33+
# Validate that credentials were found
34+
if (-not $pypiUsername -or -not $pypiPassword) {
35+
Write-Error "Error: Could not find username and/or password under the [pypi] section in '$pypircPath'."
36+
exit 1
37+
}
38+
39+
Write-Host "Credentials found. Username: $pypiUsername" # Username is usually __token__
40+
41+
# Construct and execute the uv publish command
42+
Write-Host "Attempting to publish packages using credentials from ~/.pypirc..."
43+
try {
44+
# Use Invoke-Expression if needed, but direct call is often better
45+
# Ensure the password is treated as a single argument, even if it contains special characters
46+
uv publish --username $pypiUsername --password $pypiPassword
47+
Write-Host "Publish command executed."
48+
} catch {
49+
Write-Error "Error executing uv publish: $($_.Exception.Message)"
50+
exit 1
51+
}

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)