Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit ff84cd4

Browse files
author
Bender
committed
fix(git): shipit to fetch sorted tags
1 parent 09a16d8 commit ff84cd4

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

Diff for: lib/cli/shipit.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ interface Props {
1313

1414
export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissingCommit, forceBump, releaseBranchPrefix }: Props) => {
1515
const git = simpleGit()
16+
await git.pull()
1617

17-
git.addConfig('user.name', gitUser)
18-
git.addConfig('user.email', gitEmail)
19-
20-
const tags = await git.tags()
21-
const log = await git.log()
18+
const tags = await git.tags({ '--sort': '-creatordate' })
19+
const log = await git.log({ '--max-count': 20 })
2220
const branch = await git.branch()
2321
const [remote] = await git.getRemotes()
2422

2523
const latestCommit = log.latest?.hash
2624
const latestTag = tags.latest ?? '0.0.0'
2725
const currentTag = latestTag.replace(tagPrefix, '')
2826

27+
console.log('Latest commit: ', latestCommit)
2928
console.log('Current version: ', latestTag)
3029

3130
if (!isValidTag(latestTag, tagPrefix)) {
@@ -64,6 +63,9 @@ export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissin
6463
bumps.push(BumpType.Patch)
6564
}
6665

66+
git.addConfig('user.name', gitUser)
67+
git.addConfig('user.email', gitEmail)
68+
6769
const nextTag = bumps.reduce((acc, curr) => bumpCalculator(acc, curr), currentTag)
6870
const nextTagWithPrefix = tagPrefix + nextTag
6971
const releaseBranch = `${releaseBranchPrefix}${nextTagWithPrefix}`

Diff for: package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"next": "^12.3.0",
4343
"replace-in-file": "^6.3.5",
4444
"serverless-http": "^3.0.2",
45-
"simple-git": "^3.14.0"
45+
"simple-git": "^3.14.1"
4646
},
4747
"devDependencies": {
4848
"adm-zip": "^0.5.9",
@@ -57,4 +57,4 @@
5757
"node": ">=16"
5858
},
5959
"engineStrict": true
60-
}
60+
}

0 commit comments

Comments
 (0)