|
| 1 | +/* eslint-disable no-template-curly-in-string */ |
| 2 | + |
| 3 | +const dateFormat = import('dateformat'); |
| 4 | +const promisify = import('util'); |
| 5 | +const readFile = import('fs'); |
| 6 | +const readFileAsync = promisify(readFile); |
| 7 | + |
| 8 | +// the *.hbs template and partials should be passed as strings of contents |
| 9 | +const template = readFileAsync('./build/default-template.hbs'); |
| 10 | +const commitTemplate = readFileAsync('./build/commit-template.hbs'); |
| 11 | +let choreMessage = ''; |
| 12 | +if (process.env.GITHUB_ACTIONS) { |
| 13 | + // CI IS SET |
| 14 | + choreMessage = ':construction_worker: chore(release): ${nextRelease.version}'; |
| 15 | +} else { |
| 16 | + // CI IS NOT SET |
| 17 | + choreMessage = |
| 18 | + ':construction_worker: chore(release): ${nextRelease.version} [skip ci]'; |
| 19 | +} |
| 20 | + |
| 21 | +module.exports = { |
| 22 | + release: { |
| 23 | + defaultBranch: 'main', |
| 24 | + branches: [ |
| 25 | + '+([0-9])?(.{+([0-9]),x}).x', |
| 26 | + 'main', |
| 27 | + 'next', |
| 28 | + 'next-major', |
| 29 | + { |
| 30 | + name: 'beta', |
| 31 | + prerelease: true, |
| 32 | + }, |
| 33 | + { |
| 34 | + name: 'alpha', |
| 35 | + prerelease: true, |
| 36 | + }, |
| 37 | + ], |
| 38 | + }, |
| 39 | + plugins: [ |
| 40 | + [ |
| 41 | + 'semantic-release-gitmoji', |
| 42 | + { |
| 43 | + // NOTE: These are categorized by the gitmojis.json found here |
| 44 | + // https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json |
| 45 | + releaseRules: { |
| 46 | + major: [ |
| 47 | + ':boom:', //Introduce breaking changes. |
| 48 | + ], |
| 49 | + minor: [ |
| 50 | + ':sparkles:', //Introduce new features. |
| 51 | + ], |
| 52 | + patch: [ |
| 53 | + ':zap:', //Improve performance. |
| 54 | + ':bug:', //Fix a bug. |
| 55 | + ':ambulance:', //Critical hotfix. |
| 56 | + ':lipstick:', //Add or update the UI and style files. |
| 57 | + ':lock:', //Fix security or privacy issues. |
| 58 | + ':arrow_down:', //Downgrade dependencies. |
| 59 | + ':arrow_up:', //Upgrade dependencies. |
| 60 | + ':pushpin:', //Pin dependencies to specific versions. |
| 61 | + ':chart_with_upwards_trend:', //Add or update analytics or track code. |
| 62 | + ':heavy_plus_sign:', //Add a dependency. |
| 63 | + ':heavy_minus_sign:', //Remove a dependency. |
| 64 | + ':wrench:', //Add or update configuration files. |
| 65 | + ':globe_with_meridians:', //Internationalization and localization. |
| 66 | + ':pencil2:', //Fix typos. |
| 67 | + ':rewind:', //Revert changes. |
| 68 | + ':package:', //Add or update compiled files or packages. |
| 69 | + ':alien:', //Update code due to external API changes. |
| 70 | + ':bento:', //Add or update assets. |
| 71 | + ':wheelchair:', //Improve accessibility. |
| 72 | + ':speech_balloon:', //Add or update text and literals. |
| 73 | + ':card_file_box:', //Perform database related changes. |
| 74 | + ':children_crossing:', //Improve user experience / usability. |
| 75 | + ':iphone:', //Work on responsive design. |
| 76 | + ':egg:', //Add or update an easter egg. |
| 77 | + ':alembic:', //Perform experiments. |
| 78 | + ':mag:', //Improve SEO. |
| 79 | + ':label:', //Add or update types. |
| 80 | + ':triangular_flag_on_post:', //Add, update, or remove feature flags. |
| 81 | + ':goal_net:', //Catch errors. |
| 82 | + ':dizzy:', //Add or update animations and transitions. |
| 83 | + ':wastebasket:', //Deprecate code that needs to be cleaned up. |
| 84 | + ':passport_control:', //Work on code related to authorization, roles and permissions. |
| 85 | + ':adhesive_bandage:', //Simple fix for a non-critical issue. |
| 86 | + ':necktie:', //Add or update business logic. |
| 87 | + ], |
| 88 | + // LEFT OUT AS THESE ARE N/A |
| 89 | + //':art:', //Improve structure / format of the code. |
| 90 | + //':fire:', //Remove code or files. |
| 91 | + //':memo:', //Add or update documentation. |
| 92 | + //':rocket:', //Deploy stuff. |
| 93 | + //':tada:', //Begin a project. |
| 94 | + //':white_check_mark:', //Add, update, or pass tests. |
| 95 | + //':closed_lock_with_key:', //Add or update secrets. |
| 96 | + //':bookmark:', //Release / Version tags. |
| 97 | + //':rotating_light:', //Fix compiler / linter warnings. |
| 98 | + //':construction:', //Work in progress. |
| 99 | + //':green_heart:', //Fix CI Build. |
| 100 | + //':construction_worker:', //Add or update CI build system. |
| 101 | + //':recycle:', //Refactor code. |
| 102 | + //':hammer:', //Add or update development scripts. |
| 103 | + //':poop:', //Write bad code that needs to be improved. |
| 104 | + //':twisted_rightwards_arrows:', //Merge branches. |
| 105 | + //':truck:', //Move or rename resources (e.g.: files, paths, routes). |
| 106 | + //':page_facing_up:', //Add or update license. |
| 107 | + //':bulb:', //Add or update comments in source code. |
| 108 | + //':beers:', //Write code drunkenly. |
| 109 | + //':loud_sound:', //Add or update logs. |
| 110 | + //':mute:', //Remove logs. |
| 111 | + //':busts_in_silhouette:', //Add or update contributor(s). |
| 112 | + //':building_construction:', //Make architectural changes. |
| 113 | + //':clown_face:', //Mock things. |
| 114 | + //':see_no_evil:', //Add or update a .gitignore file. |
| 115 | + //':camera_flash:', //Add or update snapshots. |
| 116 | + //':seedling:', //Add or update seed files. |
| 117 | + //':monocle_face:', //Data exploration/inspection. |
| 118 | + //':coffin:', //Remove dead code. |
| 119 | + //':test_tube:', //Add a failing test. |
| 120 | + //':stethoscope:', //Add or update healthcheck. |
| 121 | + //':bricks:', //Infrastructure related changes. |
| 122 | + //':technologist:', //Improve developer experience. |
| 123 | + //':money_with_wings:', //Add sponsorships or money related infrastructure. |
| 124 | + //':thread:', //Add or update code related to multithreading or concurrency. |
| 125 | + //':safety_vest:', //Add or update code related to validation. |
| 126 | + }, |
| 127 | + releaseNotes: { |
| 128 | + template, |
| 129 | + partials: { commitTemplate }, |
| 130 | + helpers: { |
| 131 | + datetime(format = 'UTC:yyyy-mm-dd') { |
| 132 | + return dateFormat(new Date(), format); |
| 133 | + }, |
| 134 | + }, |
| 135 | + issueResolution: { |
| 136 | + template: '{baseUrl}/{owner}/{repo}/issues/{ref}', |
| 137 | + baseUrl: 'https://github.com', |
| 138 | + source: 'github.com', |
| 139 | + removeFromCommit: false, |
| 140 | + regex: /#\d+/g, // example matches: #2341 #8 |
| 141 | + }, |
| 142 | + }, |
| 143 | + }, |
| 144 | + ], |
| 145 | + [ |
| 146 | + '@semantic-release/changelog', |
| 147 | + { |
| 148 | + changelogFile: 'CHANGELOG.md', |
| 149 | + changelogTitle: '# Changelog', |
| 150 | + }, |
| 151 | + ], |
| 152 | + [ |
| 153 | + '@semantic-release/npm', |
| 154 | + { |
| 155 | + npmPublish: false, |
| 156 | + tarballDir: 'dist', |
| 157 | + }, |
| 158 | + ], |
| 159 | + [ |
| 160 | + '@semantic-release/git', |
| 161 | + { |
| 162 | + assets: ['package.json', 'CHANGELOG.md'], |
| 163 | + message: `${choreMessage}\n\n\${nextRelease.notes}`, |
| 164 | + // message: choreMessage, |
| 165 | + }, |
| 166 | + ], |
| 167 | + [ |
| 168 | + '@semantic-release/github', |
| 169 | + { |
| 170 | + assets: [ |
| 171 | + { |
| 172 | + path: 'dist/**', |
| 173 | + }, |
| 174 | + ], |
| 175 | + }, |
| 176 | + ], |
| 177 | + ], |
| 178 | + extends: ['semantic-release-config-gitmoji'], |
| 179 | +}; |
0 commit comments