Skip to content

Commit

Permalink
chore: some in yml
Browse files Browse the repository at this point in the history
  • Loading branch information
uyriq committed Oct 28, 2024
1 parent 1aba464 commit a848270
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ on:
jobs:
release:
runs-on: windows-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get previous tag
id: get_previous_tag
shell: pwsh
run: |
# Get all tags sorted by creation date in reverse order
$tags = git tag --sort=-creatordate
Expand All @@ -25,17 +28,17 @@ jobs:
$prevTag = if ($tagsArray.Length -ge 2) { $tagsArray[1].Trim() } else { "" }
if (-not $prevTag) {
# No previous tag found, fallback to the last commit hash
$prevTag = git log -1 --pretty=format:"%H"
# will do stub
$prevTag = "0.0.1.rc"
}
# Write previous tag to environment file
Write-Host "Previous tag: $prevTag"
echo "PREV_TAG=$prevTag" >> $env:GITHUB_ENV
shell: pwsh
- name: Create release notes
id: create_release_notes
shell: pwsh
run: |
echo "## Release Notes" > release_notes.md
echo "" >> release_notes.md
Expand All @@ -44,13 +47,13 @@ jobs:
$PREV_TAG = $env:PREV_TAG
Write-Host "Previous tag: $PREV_TAG"
if ([string]::IsNullOrEmpty($PREV_TAG)) {
Write-Host "No previous tag found. Exiting."
exit 1
Write-Host "No previous tag found. Using fallback."
git log --pretty=format:%s ${GITHUB_REF}~2..${GITHUB_REF} >> release_notes.md
} else {
git log --pretty=format:%s $PREV_TAG..${GITHUB_REF} >> release_notes.md
}
git log --oneline $PREV_TAG..HEAD >> release_notes.md
echo "" >> release_notes.md
shell: pwsh
echo "" >> release_notes.md
- name: Create GitHub Release
id: create_release
Expand Down
Empty file added release_notes.md
Empty file.

0 comments on commit a848270

Please sign in to comment.