fix: pushing tags one by one on release

This commit is contained in:
Karol Sójko 2022-06-23 18:55:55 +02:00
parent c9ec846a3c
commit 8837dca039
No known key found for this signature in database
GPG key ID: A50543BF560BDEB0
2 changed files with 18 additions and 1 deletions

View file

@ -38,7 +38,8 @@
"start:files": "yarn workspace @standardnotes/files-server start",
"start:files-worker": "yarn workspace @standardnotes/files-server worker",
"start:api-gateway": "yarn workspace @standardnotes/api-gateway start",
"release:prod": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish new version\""
"release:prod": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish new version\"",
"postversion": "./scripts/push-tags-one-by-one.sh"
},
"devDependencies": {
"@commitlint/cli": "^17.0.2",

16
scripts/push-tags-one-by-one.sh Executable file
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