-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.releaserc.mjs
More file actions
94 lines (78 loc) · 2.87 KB
/
.releaserc.mjs
File metadata and controls
94 lines (78 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { execSync } from 'node:child_process'
// Git utils
function getLocalRepoUrl() {
const topLevelDir = execSync( 'git rev-parse --show-toplevel' )
.toString()
.trim()
return `file://${ topLevelDir }/.git`
}
function getCurrentBranch() {
return execSync( 'git rev-parse --abbrev-ref HEAD' )
.toString()
.trim()
}
// Plugins sub-configs
function getGitmojiPlugin() {
return [
'semantic-release-gitmoji', {
'releaseRules': {
'major': [
':boom:'
],
'minor': [
':sparkles:'
],
'patch': [
':art:', ':zap:', ':fire:', ':bug:', ':ambulance:', ':pencil:', ':rocket:', ':lipstick:', ':white_check_mark:', ':lock:', ':apple:', ':penguin:', ':checkered_flag:', ':robot:',
':green_apple:', ':rotating_light:', ':green_heart:', ':arrow_down:', ':pushpin:', ':construction_worker:', ':chart_with_upwards_trend:', ':recycle:', ':whale:',
':heavy_plus_sign:', ':heavy_minus_sign:', ':wrench:', ':globe_with_meridians:', ':pencil2:', ':poop:', ':rewind:', ':package:', ':alien:', ':truck:', ':page_facing_up:',
':bento:', ':ok_hand:', ':wheelchair:', ':bulb:', ':beers:', ':speech_balloon:', ':card_file_box:', ':loud_sound:', ':mute:', ':busts_in_silhouette:', ':children_crossing:',
':building_construction:', ':iphone:', ':clown_face:', ':see_no_evil:', ':camera_flash:', ':alembic:', ':mag:', ':wheel_of_dharma:', ':label:', ':seedling:', ':dizzy:',
':wastebasket:', ':passport_control:', ':adhesive_bandage:', ':monocle_face:', ':coffin:', ':test_tube:', ':necktie:', ':stethoscope:', ':bricks:', ':technologist:'
]
}
}
]
}
function getChangelogPlugin() {
return '@semantic-release/changelog'
}
function getNpmPlugin() {
return '@semantic-release/npm'
}
function getGithubPlugin() {
return '@semantic-release/github'
}
function getGitPlugin() {
return [
'@semantic-release/git', {
'assets': [
'builds/**', 'docs/**', 'package.json', 'CHANGELOG.md'
],
'message': 'chore(release): v${nextRelease.version}'
}
]
}
// Configuration selection
function isDryRun() {
return process.argv.includes( '--dry-run' )
}
function getDryRunConfig() {
return {
repositoryUrl: getLocalRepoUrl(),
branches: getCurrentBranch(),
plugins: [
getGitmojiPlugin()
],
}
}
function getCIConfig() {
return {
branch: 'master',
plugins: [
getGitmojiPlugin(), getChangelogPlugin(), getNpmPlugin(), getGithubPlugin(), getGitPlugin()
]
}
}
// Module
export default isDryRun() ? getDryRunConfig() : getCIConfig()