Skip to content

Commit

Permalink
Using a different strategy for handling releasing from git tag push e…
Browse files Browse the repository at this point in the history
…vents

Signed-off-by: Edmondo Porcu <[email protected]>
  • Loading branch information
edmondop committed Aug 7, 2023
1 parent 89d1b0c commit 8791dd2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,27 @@ install_chart_releaser() {
lookup_latest_tag() {
git fetch --tags >/dev/null 2>&1

if ! git describe --tags --abbrev=0 HEAD~ 2>/dev/null; then
git rev-list --max-parents=0 --first-parent HEAD
if git symbolic-ref --short -q HEAD; then
if ! git describe --tags --abbrev=0 HEAD~ 2>/dev/null; then
git rev-list --max-parents=0 --first-parent HEAD
fi
else
# In a detached HEAD state, such as when the pipeline
# is triggered by a push on a tag commit, we need to look back
# by date
current_commit=$(git rev-parse HEAD)
for tag in $(git tag --sort=-creatordate); do
if [ $(git rev-parse "$tag") = "$current_commit" ]; then
continue
else
echo "$tag"
break
fi
done
fi
}


filter_charts() {
while read -r chart; do
[[ ! -d "$chart" ]] && continue
Expand Down

0 comments on commit 8791dd2

Please sign in to comment.