This commit is contained in:
2026-07-28 21:28:53 +04:00
parent 3b01afeeb2
commit f395d2515d
3 changed files with 81 additions and 37 deletions
+7 -37
View File
@@ -617,45 +617,15 @@ try {
$env:MOONWELL_RELEASE_KEY = $S3Key
$env:MOONWELL_RELEASE_VERSION = $version
$env:MOONWELL_RELEASE_SHA256 = $installerSha256
$uploadScript = @'
import os
import boto3
from botocore.config import Config
$uploadHelper = Join-Path `
$repositoryRoot `
'tool\upload_launcher_release.py'
if (-not (Test-Path -LiteralPath $uploadHelper -PathType Leaf)) {
throw "S3 upload helper was not found: $uploadHelper"
}
path_style = os.getenv("AWS_USE_PATH_STYLE_ENDPOINT", "true").lower()
addressing_style = "path" if path_style in ("1", "true", "yes") else "virtual"
s3 = boto3.client(
"s3",
endpoint_url=os.environ["MOONWELL_RELEASE_ENDPOINT"],
region_name=os.getenv("AWS_DEFAULT_REGION", "ru-central1"),
config=Config(s3={"addressing_style": addressing_style}),
)
s3.upload_file(
os.environ["MOONWELL_RELEASE_FILE"],
os.environ["MOONWELL_RELEASE_BUCKET"],
os.environ["MOONWELL_RELEASE_KEY"],
ExtraArgs={
"ACL": "public-read",
"ContentType": "application/x-msdownload",
"CacheControl": "no-cache, max-age=0",
"Metadata": {
"launcher-version": os.environ["MOONWELL_RELEASE_VERSION"],
"sha256": os.environ["MOONWELL_RELEASE_SHA256"],
},
},
)
response = s3.head_object(
Bucket=os.environ["MOONWELL_RELEASE_BUCKET"],
Key=os.environ["MOONWELL_RELEASE_KEY"],
)
print("S3_VERSION_ID=" + str(response.get("VersionId", "")))
print("S3_CONTENT_LENGTH=" + str(response["ContentLength"]))
'@
try {
Invoke-RequiredCommand -Command $python -Arguments @(
'-c',
$uploadScript
)
Invoke-RequiredCommand -Command $python -Arguments @($uploadHelper)
}
finally {
Remove-Item Env:MOONWELL_RELEASE_FILE -ErrorAction SilentlyContinue