Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add changelog:update to constraints
  • Loading branch information
cryptodev-2s committed Dec 14, 2023
commit 58fd974c63db40e9d81203240c44f015e1b68ab1
10 changes: 10 additions & 0 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ gen_enforced_field(WorkspaceCwd, 'scripts.changelog:validate', CorrectChangelogV
atom_concat('../../scripts/validate-changelog.sh ', WorkspacePackageName, ExpectedPrefix),
\+ atom_concat(ExpectedPrefix, _, ChangelogValidationCommand).

% The "changelog:update" script for each published package must run a common
% script with the name of the package as the first argument.
gen_enforced_field(WorkspaceCwd, 'scripts.changelog:update', CorrectChangelogUpdateCommand) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
workspace_field(WorkspaceCwd, 'scripts.changelog:update', ChangelogUpdateCommand),
workspace_package_name(WorkspaceCwd, WorkspacePackageName),
atomic_list_concat(['../../scripts/update-changelog.sh ', WorkspacePackageName, ' [...]'], CorrectChangelogUpdateCommand),
atom_concat('../../scripts/update-changelog.sh ', WorkspacePackageName, ExpectedPrefix),
\+ atom_concat(ExpectedPrefix, _, ChangelogUpdateCommand).

% All non-root packages must have the same "test" script.
gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :-
WorkspaceCwd \= '.'.
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"scripts": {
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controller",
"changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers",
"publish:preview": "yarn npm publish --tag preview",
"test": "jest --reporters=jest-silent-reporter",
Expand Down
24 changes: 8 additions & 16 deletions scripts/update-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@

set -euo pipefail

# Check if the current directory is a git repository
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "Not in a git repository."
exit 1
fi

# Get the current git branch
branch=$(git rev-parse --abbrev-ref HEAD)

# Check if current branch is not a release branch
if [[ ! $branch =~ ^release/ ]]; then
echo "Not in a release branch."
exit 1
fi

# Get the current package name
if [[ $# -eq 0 ]]; then
echo "Missing package name."
Expand All @@ -26,4 +11,11 @@ fi
package_name="$1"
shift # remove package name from arguments

yarn auto-changelog update --tag-prefix "${package_name}@" --rc "$@"
# Get the current git branch
branch=$(git rev-parse --abbrev-ref HEAD)

if [[ $branch =~ "^release/" ]]; then
yarn auto-changelog update --tag-prefix "${package_name}@" --rc "$@"
else
yarn auto-changelog update --tag-prefix "${package_name}@" "$@"
fi