Skip to content

Commit 0665fbb

Browse files
committed
feat: add disable environment variables
1 parent e8fa647 commit 0665fbb

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ Feel free to change any of the above to whatever suits your purpose, our motivat
201201

202202
We are actively investigating ways to drop the 2 remaining variables as well!
203203

204+
## 🚧 Disabling auto-detect features
205+
206+
You can use these environment variables to deny execution of any part of the auto-detect features:
207+
208+
- `SR_DISABLE_CHANGELOG`
209+
- `SR_DISABLE_NPM`
210+
- `SR_DISABLE_DENO`
211+
- `SR_DISABLE_ACTIONS`
212+
- `SR_DISABLE_DOCKER`
213+
204214
## 🤝 Contributing
205215

206216
If you decide to fix a bug, make sure to use the conventional commit available at:

release.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ const {
3838
GIT_COMMITTER_EMAIL,
3939
GIT_AUTHOR_NAME,
4040
GIT_AUTHOR_EMAIL,
41+
SR_DISABLE_CHANGELOG,
42+
SR_DISABLE_NPM,
43+
SR_DISABLE_DENO,
44+
SR_DISABLE_ACTIONS,
45+
SR_DISABLE_DOCKER,
4146
} = process.env;
4247
const [owner, repo] = String(GITHUB_REPOSITORY).toLowerCase().split("/");
4348
const addPlugin = (plugin, options) => {
@@ -107,7 +112,7 @@ addPlugin("@semantic-release/release-notes-generator", {
107112
}
108113
});
109114

110-
addPlugin("@semantic-release/changelog", {
115+
SR_DISABLE_CHANGELOG === undefined && addPlugin("@semantic-release/changelog", {
111116
"changelogTitle": `# 📦 ${owner}/${repo} changelog
112117
113118
[![conventional commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
@@ -117,14 +122,14 @@ addPlugin("@semantic-release/changelog", {
117122
});
118123

119124
const pkgExists = existsSync("./package.json");
120-
if (pkgExists) {
125+
if (pkgExists && SR_DISABLE_NPM === undefined) {
121126
addPlugin("@semantic-release/npm", {
122127
"tarballDir": "pack"
123128
});
124129
}
125130

126131
const denoExists = existsSync("./deno.json");
127-
if (denoExists && !pkgExists) {
132+
if (denoExists && SR_DISABLE_DENO === undefined) {
128133
addPlugin("semantic-release-replace-plugin", {
129134
"replacements": [{
130135
"files": [
@@ -144,7 +149,7 @@ if (denoExists && !pkgExists) {
144149
}
145150

146151
const actionExists = existsSync("./action.yml");
147-
if (actionExists) {
152+
if (actionExists && SR_DISABLE_ACTIONS === undefined) {
148153
// regex the content of action.yml to replace the image tag
149154
const actionYml = execSync(`cat action.yml`, { encoding: "utf8", stdio: "pipe" });
150155
const re = new RegExp(`image:\\s'docker:\/\/ghcr.io\/${owner}\/${repo}:.*'`, "g");
@@ -202,7 +207,7 @@ addPlugin("@semantic-release/github", {
202207
});
203208

204209
const dockerExists = existsSync("./Dockerfile");
205-
if (dockerExists) {
210+
if (dockerExists && SR_DISABLE_DOCKER === undefined) {
206211
addPlugin("eclass-docker-fork", {
207212
"baseImageName": `${owner}/${repo}`,
208213
"registries": [

0 commit comments

Comments
 (0)