Skip to content

Commit 71430be

Browse files
committed
feat(github): a github addon for simple-release
1 parent a14ab74 commit 71430be

File tree

9 files changed

+266
-170
lines changed

9 files changed

+266
-170
lines changed

packages/github-release/src/index.ts

Lines changed: 0 additions & 122 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@trigen/eslint-config/jest"
66
],
77
"parserOptions": {
8-
"tsconfigRootDir": "./packages/github-release",
8+
"tsconfigRootDir": "./packages/github",
99
"project": ["./tsconfig.json"]
1010
},
1111
"rules": {
Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @simple-release/github-release
1+
# @simple-release/github
22

33
[![ESM-only package][package]][package-url]
44
[![NPM version][npm]][npm-url]
@@ -11,68 +11,64 @@
1111
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
1212
[package-url]: https://nodejs.org/api/esm.html
1313

14-
[npm]: https://img.shields.io/npm/v/@simple-release/github-release.svg
15-
[npm-url]: https://www.npmjs.com/package/@simple-release/github-release
14+
[npm]: https://img.shields.io/npm/v/@simple-release/github.svg
15+
[npm-url]: https://www.npmjs.com/package/@simple-release/github
1616

17-
[node]: https://img.shields.io/node/v/@simple-release/github-release.svg
17+
[node]: https://img.shields.io/node/v/@simple-release/github.svg
1818
[node-url]: https://nodejs.org
1919

20-
[deps]: https://img.shields.io/librariesio/release/npm/@simple-release/github-release
21-
[deps-url]: https://libraries.io/npm/@simple-release%2Fcore/tree
20+
[deps]: https://img.shields.io/librariesio/release/npm/@simple-release/github
21+
[deps-url]: https://libraries.io/npm/@simple-release%2Fgithub/tree
2222

23-
[size]: https://packagephobia.com/badge?p=@simple-release/github-release
24-
[size-url]: https://packagephobia.com/result?p=@simple-release/github-release
23+
[size]: https://packagephobia.com/badge?p=@simple-release/github
24+
[size-url]: https://packagephobia.com/result?p=@simple-release/github
2525

2626
[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/simple-release/tests.yml?branch=main
2727
[build-url]: https://github.com/TrigenSoftware/simple-release/actions
2828

2929
[coverage]: https://coveralls.io/repos/github/TrigenSoftware/simple-release/badge.svg?branch=main
3030
[coverage-url]: https://coveralls.io/github/TrigenSoftware/simple-release?branch=main
3131

32-
A github release addon for simple-release.
32+
A github addon for simple-release.
3333

3434
## Install
3535

3636
```bash
3737
# pnpm
38-
pnpm add @simple-release/github-release
38+
pnpm add @simple-release/github
3939
# yarn
40-
yarn add @simple-release/github-release
40+
yarn add @simple-release/github
4141
# npm
42-
npm i @simple-release/github-release
42+
npm i @simple-release/github
4343
```
4444

4545
## Usage
4646

4747
```js
4848
import { Releaser } from '@simple-release/core'
4949
import { PnpmProject } from '@simple-release/pnpm'
50-
import { GithubReleaseCreator } from '@simple-release/github-release'
50+
import { GithubHosting } from '@simple-release/github'
5151

52-
const project = new PnpmProject()
53-
54-
await new Releaser(project)
52+
await new Releaser({
53+
project: new PnpmProject(),
54+
hosting: new GithubHosting({
55+
token: process.env.GITHUB_TOKEN
56+
})
57+
})
5558
.bump()
5659
.commit()
5760
.tag()
5861
.push()
5962
.publish()
60-
.release(new GithubReleaseCreator({
61-
token: process.env.GITHUB_TOKEN
62-
}))
63+
.release()
6364
.run()
6465
```
6566

6667
## Options
6768

68-
### `token`
69-
70-
The GitHub personal access token to authenticate with the GitHub API.
71-
72-
### `owner`
73-
74-
The GitHub owner (username or organization) of the repository. If not provided, it will be inferred from the remote URL.
75-
76-
### `project`
77-
78-
The GitHub project (repository name) to create releases in. If not provided, it will be inferred from the remote URL.
69+
| Option | Description |
70+
|--------|-------------|
71+
| token | GitHub personal access token to authenticate with the GitHub API. |
72+
| octokit | Alternative to `token`, you can provide an instance of GitHub's Octokit client. |
73+
| owner | The GitHub owner (username or organization) of the repository. If not provided, it will be inferred from the remote URL. |
74+
| project | The GitHub project (repository name) to create releases in. If not provided, it will be inferred from the remote URL. |
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"name": "@simple-release/github-release",
2+
"name": "@simple-release/github",
33
"type": "module",
44
"version": "1.0.0",
5-
"description": "A github release addon for simple-release.",
5+
"description": "A github addon for simple-release.",
66
"author": {
77
"name": "Dan Onoshko",
88
"email": "[email protected]",
99
"url": "https://github.com/dangreen"
1010
},
1111
"license": "MIT",
12-
"homepage": "https://github.com/TrigenSoftware/simple-release/tree/master/packages/github-release#readme",
12+
"homepage": "https://github.com/TrigenSoftware/simple-release/tree/master/packages/github#readme",
1313
"funding": "https://ko-fi.com/dangreen",
1414
"repository": {
1515
"type": "git",
1616
"url": "https://github.com/TrigenSoftware/simple-release.git",
17-
"directory": "packages/github-release"
17+
"directory": "packages/github"
1818
},
1919
"bugs": {
2020
"url": "https://github.com/TrigenSoftware/simple-release/issues"
@@ -54,7 +54,6 @@
5454
},
5555
"dependencies": {
5656
"@octokit/rest": "^21.1.1",
57-
"@simple-libs/hosted-git-info": "^1.0.0",
5857
"@simple-release/core": "workspace:^"
5958
},
6059
"devDependencies": {
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
PackageJsonProject,
1111
Logger
1212
} from '@simple-release/core'
13-
import { GithubReleaseCreator } from './index.js'
13+
import { GithubHosting } from './index.js'
1414

15-
describe('github-release', () => {
16-
describe('GithubReleaseCreator', () => {
15+
describe('github', () => {
16+
describe('GithubHosting', () => {
1717
it('should run smoke test', async () => {
1818
const path = await packageJsonProject()
1919
const project = new PackageJsonProject({
@@ -26,19 +26,17 @@ describe('github-release', () => {
2626
log.push(message)
2727
}
2828
})
29-
const publusher = new GithubReleaseCreator({
29+
const publusher = new GithubHosting({
3030
token: ''
3131
})
3232

33-
await publusher.create({
33+
await publusher.createRelease({
3434
project,
3535
dryRun: true,
3636
logger: logger.createChild('release')
3737
})
3838

39-
const message = log[0].message
40-
const json = message.slice(message.indexOf('{'))
41-
const release = JSON.parse(json)
39+
const release = log[1].message
4240

4341
expect(release).toEqual({
4442
owner: 'TrigenSoftware',

0 commit comments

Comments
 (0)