Skip to content

Commit 313d416

Browse files
committed
chore: test action
1 parent cdb8f23 commit 313d416

File tree

17 files changed

+632
-76
lines changed

17 files changed

+632
-76
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/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",

packages/core/src/project/monorepo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export interface GenericMonorepoProjectOptions extends GenericProjectOptions {
5151
gitClient?: ConventionalGitClient
5252
}
5353

54+
export type GenericMonorepoProjectBumpByProjectOptions = Pick<GenericProjectBumpOptions, 'version' | 'as' | 'prerelease' | 'firstRelease' | 'skip'>
55+
5456
export interface GenericMonorepoProjectBumpOptions extends Omit<GenericProjectBumpOptions, 'tagPrefix'> {
5557
/**
5658
* Force bump projects without changes in the monorepo with fixed mode.
@@ -59,7 +61,7 @@ export interface GenericMonorepoProjectBumpOptions extends Omit<GenericProjectBu
5961
/**
6062
* Bump options for specific projects.
6163
*/
62-
byProject?: Record<string, Pick<GenericProjectBumpOptions, 'version' | 'as' | 'prerelease' | 'firstRelease'>>
64+
byProject?: Record<string, GenericMonorepoProjectBumpByProjectOptions>
6365
}
6466

6567
export abstract class GenericMonorepoProject extends GenericProject {

packages/core/src/project/project.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ConventionalGitClient } from '@conventional-changelog/git-client'
44
import { Bumper } from 'conventional-recommended-bump'
55
import { ConventionalChangelog } from 'conventional-changelog'
66
import { concatStringStream } from '@simple-libs/stream-utils'
7+
import { parseHostedGitUrl } from '@simple-libs/hosted-git-info'
78
import semver, { type ReleaseType } from 'semver'
89
import {
910
type ProjectManifestVersionUpdate,
@@ -63,6 +64,10 @@ export interface GenericProjectBumpOptions {
6364
* By default will be auto detected based on tag existence.
6465
*/
6566
firstRelease?: boolean
67+
/**
68+
* Skip bumping.
69+
*/
70+
skip?: boolean
6671
preset?: PresetParams
6772
/**
6873
* The prefix to use for the tag.
@@ -152,6 +157,17 @@ export abstract class GenericProject {
152157
this.gitClient = gitClient
153158
}
154159

160+
/**
161+
* Get the hosted git information for the project.
162+
* @returns The hosted git information.
163+
*/
164+
async getHostedGitInfo() {
165+
const remote = await this.gitClient.getConfig('remote.origin.url')
166+
const info = parseHostedGitUrl(remote)
167+
168+
return info
169+
}
170+
155171
/**
156172
* Get the commit message for the version updates.
157173
* @returns The commit message.
@@ -249,7 +265,7 @@ export abstract class GenericProject {
249265
manifest
250266
} = this
251267

252-
if (await manifest.isPrivate()) {
268+
if (options.skip || await manifest.isPrivate()) {
253269
return null
254270
}
255271

0 commit comments

Comments
 (0)