diff --git a/package.json b/package.json index 48abcce0b..324c11c01 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock && yarn install", "release:prod": "lerna version --conventional-commits --yes -m \"chore(release): publish\"", "release:beta": "lerna version --conventional-prerelease --conventional-commits --yes -m \"chore(release): publish\"", - "version": "yarn install --no-immutable && git add yarn.lock" + "version": "yarn install --no-immutable && git add yarn.lock", + "postversion": "./scripts/push-tags-one-by-one.sh" }, "resolutions": { "@types/styled-components/@types/react": "17.0.2", diff --git a/scripts/push-tags-one-by-one.sh b/scripts/push-tags-one-by-one.sh new file mode 100644 index 000000000..be6050684 --- /dev/null +++ b/scripts/push-tags-one-by-one.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# source: https://github.com/lerna/lerna/issues/2218#issuecomment-771876933 +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows +# > "Note: An event will not be created when you create more than three tags at once." +# GitHub workflows will not run if a commit includes more than 3 tags at once. This +# fix pushes tags up one by one. + +# get all tags on this commit +TAGS=$(git tag --points-at HEAD | cat) + +# only push tags one by one if there are more than 3 +if (($(echo "$TAGS"| wc -l) > 3)) +then + echo "Pushing tags one by one to avoid GitHub webhook limit of 3" + echo "$TAGS" | while read line ; do git push origin --no-follow-tags $line; done +fi \ No newline at end of file