Skip to content

Commit

Permalink
chore(release): Update release configuration for all cache modules
Browse files Browse the repository at this point in the history
  • Loading branch information
bartventer committed Jul 26, 2024
1 parent ddf225a commit b5c26ae
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 43 deletions.
70 changes: 68 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,76 @@
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": "./scripts/release-rules.cjs"
"releaseRules": "./release/release-rules.cjs"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": true
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "sec",
"section": "Security"
},
{
"type": "chore",
"section": "Chores"
}
],
"preMajor": true
},
"writerOpts": {
"commitsSort": [
"subject",
"scope"
]
}
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"go.testTimeout": "15m"
"go.testTimeout": "15m",
"json.schemas": [
{
"fileMatch": [
"/workspaces/gocache/release/.releaserc.submodule.json",
],
"url": "https://json.schemastore.org/semantic-release.json"
}
]
}
7 changes: 0 additions & 7 deletions memcache/.releaserc.json

This file was deleted.

3 changes: 3 additions & 0 deletions memcache/.releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- ../release/.releaserc.submodule.json
tagFormat: memcache/v${version}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
},
"dependencies": {
"@semantic-release/git": "^10.0.1",
"conventional-changelog-conventionalcommits": "^8.0.0",
"semantic-release": "^24.0.0"
},
"scripts": {
"release": "cd $GOMODDIR && semantic-release"
"release": "cd $RELEASEDIR && semantic-release"
}
}
}
7 changes: 0 additions & 7 deletions ramcache/.releaserc.json

This file was deleted.

3 changes: 3 additions & 0 deletions ramcache/.releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- ../release/.releaserc.submodule.json
tagFormat: ramcache/v${version}
7 changes: 0 additions & 7 deletions redis/.releaserc.json

This file was deleted.

3 changes: 3 additions & 0 deletions redis/.releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- ../release/.releaserc.submodule.json
tagFormat: redis/v${version}
7 changes: 0 additions & 7 deletions rediscluster/.releaserc.json

This file was deleted.

3 changes: 3 additions & 0 deletions rediscluster/.releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- ../release/.releaserc.submodule.json
tagFormat: rediscluster/v${version}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"extends": [
"../.releaserc.json"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": "../scripts/release-rules.cjs"
"releaseRules": "../release/release-rules.cjs"
}
],
"@semantic-release/git"
Expand Down
3 changes: 3 additions & 0 deletions release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# release

This directory contains the semantic-release configuration for this monorepo.
18 changes: 14 additions & 4 deletions scripts/release-rules.cjs → release/release-rules.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/**
* Custom `releaseRules` rules before v1.0.0.
* For the original rules, see: https://github.com/semantic-release/commit-analyzer/blob/master/lib/default-release-rules.js
*
* @type {Array}
*/
* @type {Array<{
* breaking?: boolean;
* revert?: boolean;
* type?: "feat" | "fix" | "perf" | "chore" | "docs" | "style" | "refactor" | "test" | "build" | "ci" | "revert";
* scope?: string;
* emoji?: string;
* tag?: string;
* component?: string;
* release: "patch" | "minor" | "major";
* }>}
*/
module.exports = [
{ breaking: true, release: "minor" },
{ breaking: true, release: "minor" }, // Custom rule for breaking changes
{ revert: true, release: "patch" },
// Angular
{ type: "feat", release: "minor" },
Expand All @@ -21,7 +31,7 @@ module.exports = [
{ tag: "FEATURE", release: "minor" },
{ tag: "SECURITY", release: "patch" },
// ESLint
{ tag: "Breaking", release: "minor" },
{ tag: "Breaking", release: "minor" }, // Custom rule for breaking changes
{ tag: "Fix", release: "patch" },
{ tag: "Update", release: "minor" },
{ tag: "New", release: "minor" },
Expand Down
25 changes: 20 additions & 5 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail

# This script is used to release the project in all directories that contain a .releaserc.json file.
# This script is used to release the project in all directories that contain a .releaserc.(json|yml|yaml) file.

if [[ -z "${CI-}" ]] && [[ "$*" != *--dry-run* ]]; then
echo "🚨 WARNING: You are about to release without the --dry-run flag."
echo "🚨 WARNING: This will publish the new version(s) and create a new git tag(s)."
echo "🚨 WARNING: Are you sure you want to continue? (y/N)"
read -r response
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo "🚫 Release process aborted."
exit 1
fi
fi

echo "================================================================================"
echo "🔧 Starting Release Process"
echo "================================================================================"

yarn install

releasedirs=$(find . -name '.releaserc.json' -type f -exec dirname {} \; | sort)
releasercs=$(find . \
-name '.releaserc.json' -type f \
-o -name '.releaserc.yml' -type f \
-o -name '.releaserc.yaml' -type f | sort)

for dir in $releasedirs; do
for rc in $releasercs; do
echo "--------------------------------------------------------------------------------"
echo "Releasing in: $dir"
echo "Releasing for $rc"
echo "--------------------------------------------------------------------------------"
GOMODDIR=$dir yarn run release "$@"
dir=$(dirname "$rc")
RELEASEDIR=$dir yarn run release "$@"
echo " ✔️ Released successfully."
done

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,13 @@ conventional-changelog-angular@^8.0.0:
dependencies:
compare-func "^2.0.0"

conventional-changelog-conventionalcommits@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-8.0.0.tgz#3fa2857c878701e7f0329db5a1257cb218f166fe"
integrity sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==
dependencies:
compare-func "^2.0.0"

conventional-changelog-writer@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-8.0.0.tgz#81522ed40400a4ca8ab78a42794aae9667c745ae"
Expand Down

0 comments on commit b5c26ae

Please sign in to comment.