-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrelease.ps1
More file actions
executable file
·44 lines (36 loc) · 1.45 KB
/
release.ps1
File metadata and controls
executable file
·44 lines (36 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<#
generated with CMTools 2.2.7 b3036dd [{releaseDate}}
.SYNOPSIS
Release script for dataset on GitHub using gh CLI.
#>
# Determine repository and group IDs
$repoId = Split-Path -Leaf -Path (Get-Location)
$groupId = Split-Path -Leaf -Path (Split-Path -Parent -Path (Get-Location))
$repoUrl = "https://github.com/$groupId/$repoId"
Write-Output "REPO_URL -> $repoUrl"
# Generate a new draft release using jq and gh
$releaseTag = "v$(jq -r .version codemeta.json)"
$releaseNotes = jq -r .releaseNotes codemeta.json | ForEach-Object { $_ -replace "`n", " " -replace "`'", "'" }
Write-Output "tag: $releaseTag, notes:"
jq -r .releaseNotes codemeta.json | Out-File -FilePath release_notes.tmp -Encoding utf8
Get-Content release_notes.tmp
# Prompt user to push release to GitHub
$yesNo = Read-Host -Prompt "Push release to GitHub with gh? (y/N)"
if ($yesNo -eq "y") {
# Assuming 'make save' is a placeholder for a command you have
# Replace 'make save' with the appropriate PowerShell command or function
Write-Output "Preparing for $releaseTag, $releaseNotes"
# Create a draft release
Write-Output "Pushing release $releaseTag to GitHub"
gh release create "$releaseTag" `
--draft `
--notes-file release_notes.tmp `
--generate-notes
Write-Output "Uploading distribution files"
gh release upload "$releaseTag" dist/*.zip
@"
Now go to repo release and finalize draft.
$repoUrl/releases
"@
Remove-Item release_notes.tmp
}