mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-16 16:00:35 -04:00
Create Draft Release script (test version)
Former-commit-id: 0044973e02e15426d4915d29d2371df138f18057 [formerly 1007e8031a2830f619458a14c10d6ead82ae36b0 [formerly 894fdad2bba81c03878213745bd0bae46de7abba]] Former-commit-id: 7cf01318eb05768019d86afa5d1e368e6414d75e Former-commit-id: 3bd3a76ceddf3870ff24eff7effbe2ed0ff5c804
This commit is contained in:
parent
24ce5a29a1
commit
8bcdd847b5
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@ null
|
|||||||
/scripts/ssh_key
|
/scripts/ssh_key
|
||||||
/scripts/secret_files.*
|
/scripts/secret_files.*
|
||||||
|
|
||||||
|
/scripts/github_token
|
||||||
|
62
scripts/Create-DraftRelease.ps1
Normal file
62
scripts/Create-DraftRelease.ps1
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
# Provide parameters
|
||||||
|
$tag_name = "v9.8.8-test"
|
||||||
|
$release_title = "My new release!"
|
||||||
|
$release_body = "This is a test release. Please delete."
|
||||||
|
$upload_assets = @('PowerShell.Installation.Script.KiwixWebApp_0.0.0.0_Test.zip')
|
||||||
|
$release_uri = 'https://api.github.com/repos/kiwix/kiwix-js-windows/releases'
|
||||||
|
$github_token = Get-Content "$PSScriptRoot/github_token" -Raw
|
||||||
|
|
||||||
|
# Set up release_params object
|
||||||
|
$release_params = @{
|
||||||
|
Uri = $release_uri
|
||||||
|
Method = 'POST'
|
||||||
|
Headers = @{
|
||||||
|
'Authorization' = "token $github_token"
|
||||||
|
'Accept' = 'application/vnd.github.everest-preview+json'
|
||||||
|
}
|
||||||
|
Body = @{
|
||||||
|
'tag_name' = $tag_name
|
||||||
|
'name' = $release_title
|
||||||
|
'draft' = $true
|
||||||
|
'body' = $release_body
|
||||||
|
} | ConvertTo-Json
|
||||||
|
ContentType = "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Post to the release server
|
||||||
|
$release = Invoke-RestMethod @release_params
|
||||||
|
|
||||||
|
# Check that we appear to have created a release
|
||||||
|
if ($release.assets_url -imatch '^https:') {
|
||||||
|
$upload_uri = $release.upload_url -ireplace '\{[^{}]+}', ''
|
||||||
|
"Uploading assets to: $upload_uri..."
|
||||||
|
$upload_file = "$PSScriptRoot\" + $upload_assets[0]
|
||||||
|
# Establish upload params
|
||||||
|
$upload_params = @{
|
||||||
|
Uri = $upload_uri + "?name=" + $upload_assets[0]
|
||||||
|
Method = 'POST'
|
||||||
|
Headers = @{
|
||||||
|
'Authorization' = "token $github_token"
|
||||||
|
'Accept' = 'application/vnd.github.everest-preview+json'
|
||||||
|
}
|
||||||
|
# Body = [System.IO.File]::ReadAllBytes($upload_file)
|
||||||
|
InFile = $upload_file
|
||||||
|
ContentType = 'application/octet-stream'
|
||||||
|
}
|
||||||
|
echo $upload_params
|
||||||
|
# Upload asset to the release server
|
||||||
|
# $upload = [System.IO.File]::ReadAllBytes($upload_file) | Invoke-RestMethod @upload_params
|
||||||
|
$upload = Invoke-RestMethod @upload_params
|
||||||
|
if ($upload.url -imatch '^https:') {
|
||||||
|
"`nUpload successfully posted as " + $upload.url
|
||||||
|
"`nFull details:"
|
||||||
|
echo $upload
|
||||||
|
"Done."
|
||||||
|
} else {
|
||||||
|
"The upload appears to have failed. The response was:"
|
||||||
|
echo $upload
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"There was an error setting up the release! The server returned:\n\n$release"
|
||||||
|
}
|
Binary file not shown.
@ -1,8 +0,0 @@
|
|||||||
& curl @('-u', 'jaifroid:personal-access-token-here', '-X', 'POST', '-H', 'Accept: application/vnd.github.v3+json', 'https://api.github.com/repos/kiwix/kiwix-js-windows/releases', '-d', @"
|
|
||||||
{
|
|
||||||
\"tag_name\":\"v1.1.3E\",
|
|
||||||
\"name\":\"A test release!\",
|
|
||||||
\"draft\":true,
|
|
||||||
\"body\":\"This is my test release.\"
|
|
||||||
}
|
|
||||||
"@)
|
|
Loading…
x
Reference in New Issue
Block a user