Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
push:
branches:
- action
jobs:
release:
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Create pull request with release changes
run: pnpm tsm --no-warnings ./packages/ci/src/pr.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .simple-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { PnpmWorkspacesProject } from './packages/pnpm/src/index.js'
// import { GithubHosting } from './packages/github/src/index.js'

export const project = new PnpmWorkspacesProject({
mode: 'fixed'
})

// export const hosting = new GithubHosting({
// token: process.env.GITHUB_TOKEN
// })

export const releaser = {
verbose: true
}

// export const bump = {
// byProject: {
// 'simple-github-release': {
// firstRelease: false
// }
// }
// }
11 changes: 11 additions & 0 deletions packages/ci/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"@trigen/eslint-config/typescript",
"@trigen/eslint-config/typescript-requiring-type-checking",
"@trigen/eslint-config/jest"
],
"parserOptions": {
"tsconfigRootDir": "./packages/ci",
"project": ["./tsconfig.json"]
}
}
37 changes: 37 additions & 0 deletions packages/ci/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "ci",
"type": "module",
"private": true,
"version": "0.0.0",
"description": "A ci utilities.",
"author": {
"name": "Dan Onoshko",
"email": "[email protected]",
"url": "https://github.com/dangreen"
},
"license": "MIT",
"homepage": "https://github.com/TrigenSoftware/simple-release/tree/master/packages/ci#readme",
"funding": "https://ko-fi.com/dangreen",
"repository": {
"type": "git",
"url": "https://github.com/TrigenSoftware/simple-release.git",
"directory": "packages/ci"
},
"bugs": {
"url": "https://github.com/TrigenSoftware/simple-release/issues"
},
"keywords": [],
"engines": {
"node": ">=18"
},
"scripts": {
"lint": "eslint --parser-options tsconfigRootDir:. '**/*.{js,ts}'",
"test:types": "tsc --noEmit",
"test": "run -p lint test:types"
},
"dependencies": {
"@actions/github": "^6.0.1",
"@simple-release/config": "workspace:^",
"@simple-release/github-action": "workspace:^"
}
}
31 changes: 31 additions & 0 deletions packages/ci/src/pr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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
})
// await new ReleaserGithubAction({
// project,
// octokit: getOctokit(process.env.GITHUB_TOKEN!),
// ...releaser
// })
// .setOptions(options)
// .runPullRequestAction()
const r = new ReleaserGithubAction({
project,
octokit: getOctokit(process.env.GITHUB_TOKEN!),
...releaser
})
.setOptions(options)

console.log({
ifReleaseCommit: await ifReleaseCommit(r)
})

await r.runPullRequestAction()
28 changes: 28 additions & 0 deletions packages/ci/src/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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
})

await new ReleaserGithubAction({
project,
octokit: getOctokit(process.env.GITHUB_TOKEN!),
...releaser,
dryRun: true
})
.setOptions(options)
.tag()
.push()
.release()
// .publish()
.run(ifReleaseCommit)
12 changes: 12 additions & 0 deletions packages/ci/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": [
"src"
],
"exclude": [
"**/*.spec.ts"
]
}
7 changes: 7 additions & 0 deletions packages/ci/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"include": [
"src"
],
"exclude": []
}
10 changes: 10 additions & 0 deletions packages/config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.0](https://github.com/TrigenSoftware/simple-release/compare/v1.0.0...v2.0.0) (2025-06-04)

### Features

* a simple-release config loader ([97965d2](https://github.com/TrigenSoftware/simple-release/commit/97965d29ab28d40836cf5ef3d5e4e04f908e7037))
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@simple-release/config",
"type": "module",
"version": "1.0.0",
"version": "2.0.0",
"description": "A simple-release config loader.",
"author": {
"name": "Dan Onoshko",
Expand Down
10 changes: 10 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.0](https://github.com/TrigenSoftware/simple-release/compare/v1.0.0...v2.0.0) (2025-06-04)

### Features

* a simple tool to release projects with monorepo support ([d695be5](https://github.com/TrigenSoftware/simple-release/commit/d695be51e9e0fdf12acfb86a8d0cefe802012271))
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@simple-release/core",
"type": "module",
"version": "1.0.0",
"version": "2.0.0",
"description": "A simple tool to release projects with monorepo support.",
"author": {
"name": "Dan Onoshko",
Expand Down
14 changes: 14 additions & 0 deletions packages/github-action/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
"@trigen/eslint-config/typescript",
"@trigen/eslint-config/typescript-requiring-type-checking",
"@trigen/eslint-config/jest"
],
"parserOptions": {
"tsconfigRootDir": "./packages/github-action",
"project": ["./tsconfig.json"]
},
"rules": {
"@typescript-eslint/naming-convention": "off"
}
}
6 changes: 6 additions & 0 deletions packages/github-action/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.0](https://github.com/TrigenSoftware/simple-release/compare/v1.0.0...v2.0.0) (2025-06-04)
106 changes: 106 additions & 0 deletions packages/github-action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# @simple-release/github-action

[![ESM-only package][package]][package-url]
[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependencies status][deps]][deps-url]
[![Install size][size]][size-url]
[![Build status][build]][build-url]
[![Coverage status][coverage]][coverage-url]

[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
[package-url]: https://nodejs.org/api/esm.html

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

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

[deps]: https://img.shields.io/librariesio/release/npm/@simple-release/github-action
[deps-url]: https://libraries.io/npm/@simple-release%2Fgithub-actions/tree

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

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

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

A simple-release api for github action.

## Install

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

## Usage

```js
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
})

// Create pull request with version bump
await new Releaser({
project,
octokit: getOctokit(token),
...releaser
})
.setOptions(options)
.checkout()
.fetchOptions()
.bump()
.commit()
.push()
.pullRequest()
.run()

// Publish release and project
await new Releaser({
project,
octokit: getOctokit(token),
...releaser
})
.setOptions(options)
.tag()
.push()
.release()
.publish()
.run(ifReleaseCommit)
```

### 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.
Loading