Skip to content

Commit 3af1587

Browse files
ci: correctly generate changelog for release
1 parent a93c4eb commit 3af1587

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0 # Fetch all history and tags
1214

1315
- name: Install pnpm
1416
uses: pnpm/action-setup@v4

changelog.config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import { execFileSync } from 'node:child_process'
1+
import { x } from 'tinyexec'
22
import type { ChangelogConfig } from 'changelogen'
33

4-
function getGitTags() {
5-
const stdout = execFileSync('git', ['--no-pager', 'tag', '-l', '--sort=-creatordate'], { encoding: 'utf8' })
4+
async function getGitTags() {
5+
const { stdout } = await x('git', ['--no-pager', 'tag', '-l', '--sort=-creatordate'])
6+
67
const tags = stdout.trim().split('\n').filter(Boolean)
78
return {
89
latestTag: tags[0] || '',
910
penultimateTag: tags[1] || '',
1011
}
1112
}
1213

13-
const { latestTag, penultimateTag } = getGitTags()
14+
const { latestTag, penultimateTag } = await getGitTags()
15+
16+
console.log(`Latest tag used: ${latestTag}`, `Penultimate tag used: ${penultimateTag}`)
1417

1518
export default {
1619
from: penultimateTag,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"@iconify-json/mdi": "^1.2.3",
4444
"@tailwindcss/typography": "^0.5.16",
4545
"changelogen": "^0.6.1",
46-
"eslint": "^9.26.0"
46+
"eslint": "^9.26.0",
47+
"tinyexec": "^1.0.1"
4748
},
4849
"pnpm": {
4950
"supportedArchitectures": {

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)