2.2.0 • Published 6 days ago

@simple-release/github-action v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

@simple-release/github-action

ESM-only package NPM version Node version Dependencies status Install size Build status Coverage status

A simple-release api for github action.

Install

# pnpm
pnpm add @simple-release/github-action
# yarn
yarn add @simple-release/github-action
# npm
npm i @simple-release/github-action

Usage

import { 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()

fethchOptions

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.