Skip to content

Commit

Permalink
ci: fix auto relase description
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Mar 25, 2021
1 parent b07c595 commit 5e1628a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
5 changes: 4 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ after_build:
artifacts:
- path: build\WuLiFang-Nuke-*.zip
name: Built package
before_deploy:
- ps: |
${env:APPVEYOR_RELEASE_DESCRIPTION} = ./scripts/get_changelog.ps1 -Version $env:APPVEYOR_REPO_TAG_NAME
deploy:
tag: $(APPVEYOR_REPO_TAG_NAME)
release: $(APPVEYOR_REPO_TAG_NAME)
Expand All @@ -17,7 +20,7 @@ deploy:
auth_token:
secure: F3Yyeg/9CKfhBQ6baTP5XsOqnquey/5hXl1EtPqmk0WptSzV6STE7M4Pa+BJnTZ2
artifact: /.*\.zip/
draft: true
draft: false
prerelease: false
on:
branch: /v.+/
Expand Down
30 changes: 30 additions & 0 deletions scripts/get_changelog.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
param (
[Parameter()]
[String]
$Version
)

$ret = @()
$isMatch = $false
foreach ($line in Get-Content -Encoding utf8 docs/changelog.md) {
if ($line -match "## \[(?<version>.+)]") {
if ($Matches.version -eq ($Version -replace "^v", "")) {
$isMatch = $true
}
elseif ($isMatch) {
break
}
continue
}

if ($isMatch) {
$ret += $line
}
}

if ($ret.Length -eq 0) {
throw "Version not found: $Version"
}


return ($ret -join "`n").TrimStart()

0 comments on commit 5e1628a

Please sign in to comment.