Skip to content

Commit 6a28f48

Browse files
committed
chore: test action
1 parent cdb8f23 commit 6a28f48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1282
-496
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: simple-release
2+
description: A simple tool to release projects with monorepo support.
3+
inputs:
4+
action:
5+
description: |
6+
Action that simple-release should do:
7+
- pr - create pull request with release changes
8+
- release - create tags, release notes and publish, only if pull request with fresh release was merged
9+
default: pr
10+
token:
11+
description: GitHub Token
12+
branch:
13+
description: Branch name to store release changes
14+
default: simple-release
15+
runs:
16+
using: node20
17+
main: dist/index.js

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- action
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
name: Release
10+
steps:
11+
- name: Checkout the repository
12+
uses: actions/checkout@v4
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v2
15+
with:
16+
version: 10
17+
- name: Install Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 18
21+
cache: 'pnpm'
22+
- name: Install dependencies
23+
run: pnpm install
24+
- name: Create pull request with release changes
25+
run: pnpm tsm --no-warnings ./packages/github-action/src/index.ts
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ node_modules
2323
dist
2424
packages/*/package
2525
build
26+
!.github/actions/*/dist
27+
!.github/actions/*/dist/node_modules
2628

2729
# Env files
2830
.env

packages/core/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ Project is a class that represents the project and provides methods to work with
155155
- publish the project
156156
- etc.
157157

158-
Most of the methods are implemented in base class [GenericProject](./src/project/project.ts) and you can extend it to create your own project class.
158+
Most of the methods are implemented in base class [Project](./src/project/project.ts) and you can extend it to create your own project class.
159159

160160
In most casses you need just prepare options for the base class and implement `publish` method (like it is done in [PackageJsonProject](./src/project/packageJson.ts)).
161161

162162
```js
163-
import { GenericProject } from '@simple-release/core'
163+
import { Project } from '@simple-release/core'
164164

165-
export class CustomProject extends GenericProject {
165+
export class CustomProject extends Project {
166166
constructor(options) {
167167
super({
168168
...options,
@@ -176,7 +176,7 @@ export class CustomProject extends GenericProject {
176176
}
177177
```
178178

179-
There also is a base class for monorepo projects - [GenericMonorepoProject](./src/project/monorepo.ts). It provides methods to work with monorepo projects and you can extend it to create your own monorepo project class (alos see [PackageJsonMonorepoProject](./src/project/packageJsonMonorepo.ts)).
179+
There also is a base class for monorepo projects - [MonorepoProject](./src/project/monorepo.ts). It provides methods to work with monorepo projects and you can extend it to create your own monorepo project class (alos see [PackageJsonMonorepoProject](./src/project/packageJsonMonorepo.ts)).
180180

181181
### Release creator
182182

@@ -185,9 +185,9 @@ Release creator is a class that creates a release in the remote repository (like
185185
Signature of the class is very simple, you just need to implement `create` method:
186186

187187
```js
188-
import { GenericReleaseCreator } from '@simple-release/core'
188+
import { ReleaseCreator } from '@simple-release/core'
189189

190-
export class CustomReleaseCreator extends GenericReleaseCreator {
190+
export class CustomReleaseCreator extends ReleaseCreator {
191191
async create({ project, dryRun, logger }) {
192192
// Create the release in the remote repository
193193
// You can use `project` to get information about the project

packages/core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
"test": "run -p lint test:unit test:types"
5959
},
6060
"dependencies": {
61-
"@conventional-changelog/git-client": "^2.4.0",
61+
"@conventional-changelog/git-client": "^2.5.1",
6262
"@simple-libs/child-process-utils": "^1.0.0",
63+
"@simple-libs/hosted-git-info": "^1.0.0",
6364
"@simple-libs/stream-utils": "^1.0.0",
6465
"conventional-changelog": "^7.0.2",
6566
"conventional-changelog-conventionalcommits": "^9.0.0",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type {
2+
CreateReleaseOptions,
3+
CreatePullRequestOptions
4+
} from './hosting.types.js'
5+
6+
export * from './hosting.types.js'
7+
8+
/**
9+
* A base class that represents a git repository hosting service.
10+
*/
11+
export abstract class GitRepositoryHosting {
12+
/**
13+
* Creates a new release for the given project.
14+
* @param options
15+
*/
16+
abstract createRelease(options: CreateReleaseOptions): Promise<void>
17+
18+
/**
19+
* Creates a pull request for the given project.
20+
* @param options
21+
*/
22+
abstract createPullRequest(options: CreatePullRequestOptions): Promise<void>
23+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { Project } from '../project/project.js'
2+
import type { ChildLogger } from '../logger.js'
3+
4+
export interface ReleaseData {
5+
version: string
6+
title: string
7+
notes: string
8+
previousTag: string
9+
nextTag: string
10+
isPrerelease: boolean
11+
}
12+
13+
export interface CreateReleaseOptions {
14+
project: Project
15+
dryRun?: boolean
16+
logger?: ChildLogger
17+
}
18+
19+
export interface CreatePullRequestOptions {
20+
project: Project
21+
/**
22+
* Base branch for the pull request.
23+
*/
24+
to?: string
25+
/**
26+
* Head branch for the pull request.
27+
*/
28+
from?: string
29+
dryRun?: boolean
30+
logger?: ChildLogger
31+
}

packages/core/src/hosting/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './hosting.js'

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export * from './manifest/index.js'
22
export * from './project/index.js'
3-
export * from './release/index.js'
3+
export * from './hosting/index.js'
44
export * from './logger.js'
55
export * from './releaser.js'

packages/core/src/manifest/manifest.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import { dirname } from 'path'
22
import semver from 'semver'
3+
import type { ProjectManifestVersionUpdate } from './manifest.types.js'
34

4-
export interface ProjectManifestVersionUpdate {
5-
name: string
6-
from: string
7-
to: string
8-
files: string[]
9-
}
5+
export * from './manifest.types.js'
106

117
/**
128
* A base class for project manifests.

0 commit comments

Comments
 (0)