A simple-release api for github action.
# pnpm
pnpm add @simple-release/github-action
# yarn
yarn add @simple-release/github-action
# npm
npm i @simple-release/github-actionimport { getOctokit } from '@actions/github'
import { load } from '@simple-release/config'
import { ReleaserGithubAction, ifReleaseCommit } from '@simple-release/github-action'
const {
project,
releaser,
...options
} = await load({
config: true,
project: true
})
const action = await new ReleaserGithubAction({
project,
octokit: getOctokit(token),
...releaser
})
// Create pull request with version bump
action
.setOptions(options)
.checkout()
.fetchOptions()
.bump()
.commit()
.push()
.pullRequest()
.run()
// Publish release and project
action
.setOptions(options)
.tag()
.push()
.release()
.publish()
.run(ifReleaseCommit)
// Run all steps to create a pull request with version bump
action
.setOptions(options)
.runPullRequestAction()
// Run all steps to release project
action
.setOptions(options)
.runReleaseAction()
// Detect action by commit type and run appropriate steps
action
.setOptions(options)
.runAction()You can pass additional options to releaser via comment in your pull request. Your comment should start with !simple-release/set-options and contain JSON object with options. For example:
!simple-release/set-options
```json
{
"bump": {
"prerelease": "alpha"
}
}
```To fetch and parse comments you should use fetchOptions step after checkout step.