Skip to content

Commit

Permalink
fix: write changelog locally should run before publish
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Jun 22, 2024
1 parent 02516b3 commit eea163c
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class ReleaseItPnpmPlugin extends Plugin {
this.setContext({ newVersion })

const { publishCommand = defaultPublishCommand } = this.options
const { inFile } = this.options
const isDryRun = this.options['dry-run']

let needPublish = false

if (!this.options['dry-run']) {
Expand Down Expand Up @@ -178,6 +181,12 @@ class ReleaseItPnpmPlugin extends Plugin {
},
)

this.log.exec(`Writing changelog to ${inFile}`, isDryRun)
if (inFile && !isDryRun) {
const { md } = await generate()
await this.writeChangelog(md, newVersion)
}

if (needPublish) {
await this.step({
task: () => this.exec(publishCommand.replace('$tag', tag)),
Expand Down Expand Up @@ -218,19 +227,6 @@ class ReleaseItPnpmPlugin extends Plugin {
await this.exec(`git add ${inFile}`)
}

async beforeRelease() {
const { newVersion } = this.getContext()
const { inFile } = this.options
const isDryRun = this.options['dry-run']

this.log.exec(`Writing changelog to ${inFile}`, isDryRun)

if (inFile && !isDryRun) {
const { md } = await generate()
await this.writeChangelog(md, newVersion)
}
}

async release() {
if (this.options?.disableRelease)
return
Expand Down

0 comments on commit eea163c

Please sign in to comment.