Skip to content

Commit

Permalink
Release v1.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Jan 18, 2024
1 parent 1fac171 commit 086cc84
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

Tag ranges `v0.1.0...v1.12.0` (31). [All GitHub Releases](https://github.com/lvjiaxuan/release/releases).
Tag ranges `v0.1.0...v1.12.1` (32). [All GitHub Releases](https://github.com/lvjiaxuan/release/releases).

## v1.12.1 <sub>(2024-01-18)</sub>
[Compare changes](https://github.com/lvjiaxuan/release/compare/v1.12.0...v1.12.1)

### &nbsp;&nbsp;&nbsp;🐛 Fixes

- **release**: catch unknown error &nbsp;-&nbsp; by @lvjiaxuan [<samp>(1fac1)</samp>](https://github.com/lvjiaxuan/release/commit/1fac171)

## v1.12.0 <sub>(2024-01-18)</sub>
[Compare changes](https://github.com/lvjiaxuan/release/compare/v1.11.0...v1.12.0)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lvr",
"type": "module",
"version": "1.12.0",
"version": "1.12.1",
"private": false,
"description": "My own release cli tool.",
"author": "lvjiaxuan <471501748@qq.com> (https://github.com/lvjiaxuan)",
Expand Down Expand Up @@ -78,7 +78,7 @@
},
"lint-staged": {
"*": "eslint --fix",
"*.?([cm])tsx": "nr typecheck"
"*.?([cm])ts?(x)": "nr typecheck"
},
"lv": {
"release": {
Expand Down
4 changes: 3 additions & 1 deletion src/command/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import process from 'node:process'
import path from 'node:path'
import fsp from 'node:fs/promises'
import p from 'picocolors'
import { info } from '@actions/core'
import { info, setOutput } from '@actions/core'
import { $ } from 'execa'
import type { PublishOption } from '..'

Expand All @@ -20,6 +20,8 @@ export async function publish(options: PublishOption) {
return false
})()

setOutput('isWorkspace', isWorkspace)

const publishCommand = `pnpm publish${isWorkspace ? ' -r --report-summary' : ''} --no-git-checks`
info(`${p.blue(publishCommand)}\n`)
await $$`${publishCommand}`
Expand Down
25 changes: 10 additions & 15 deletions src/command/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promises as fsp } from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import { getOctokit } from '@actions/github'
import { error, info, setFailed, warning } from '@actions/core'
import { info, setFailed, warning } from '@actions/core'
import p from 'picocolors'

const cwd = process.cwd()
Expand All @@ -18,7 +18,7 @@ export function resolveChangelogSection(content: string) {
catch {
}

warning('Failed to resolve release notes on CHANGELOG.md. Callback to "".')
warning('Failed to resolve release notes on CHANGELOG.md. Callback to "".\n')

return ''
}
Expand All @@ -31,12 +31,12 @@ export async function sendRelease() {
const octokit = getOctokit(token!)

if (CI !== 'true') {
warning('Not in CI env. Skip release.')
warning('Not in CI env. Skip release.\n')
return
}

if (!token) {
warning('No token in env. Skip release.')
warning('No token in env. Skip release.\n')
return
}

Expand All @@ -53,20 +53,20 @@ export async function sendRelease() {

await octokit.rest.repos.createRelease(releaseBody)
.then((res) => {
info(p.green(`Successfully created a release: ${res.data.html_url} .`))
info(p.green(`Successfully created a release: ${res.data.html_url} .\n`))
}).catch((err: any) => {
info(JSON.stringify(err))
// eslint-disable-next-line ts/no-unsafe-member-access
if (err.status === 422 && err.data.errors[0].code === 'already_exists') {
info(p.yellow(`The tag name \`${tag}\` of release already exists. So update it.`))
info(p.yellow(`The tag name \`${tag}\` of release already exists. So update it.\n`))

return octokit.rest.repos.getReleaseByTag({
owner,
repo,
tag: tag!,
})
}
setFailed(`Fail to release. ${err}`)
process.exit(1)
return Promise.reject(err)
}).then((res) => {
if (res) {
const { data: { id } } = res
Expand All @@ -79,12 +79,7 @@ export async function sendRelease() {
if (res)
info(p.green(`Successfully updated a release: ${res.data.html_url} .`))
}).catch((err: any) => {
if (err) {
setFailed(`Fail to release. ${err}`)
// eslint-disable-next-line ts/no-unsafe-argument
error(JSON.parse(err))
}
if (err)
setFailed(`Fail to release with ${err}\n`)
})

process.exit(0)
}

0 comments on commit 086cc84

Please sign in to comment.