chore: adjust publishing workflows to account for more than 3 tags pushed at once

This commit is contained in:
Mo
2022-06-15 16:26:04 -05:00
parent 66ef4a8901
commit 58119dda51
2 changed files with 18 additions and 1 deletions

View File

@@ -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",

View File

@@ -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