Skip to content

Commit

Permalink
Fixed changelog generation script
Browse files Browse the repository at this point in the history
A few bash-fu problems where fiddling with markdown formatting, fixed that.
  • Loading branch information
maoueh committed Sep 28, 2022
1 parent c4cf71a commit 538600b
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions .github/generate_change_log.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
#!/usr/bin/env bash
checksum() {
echo $(sha256sum $@ | awk '{print $1}')
}

change_log_file="./CHANGELOG.md"
version="## $@"
version_prefix="## [0-9]{1,2}\."
start=0
CHANGE_LOG=""
while read line; do

main() {
change_log_file="./CHANGELOG.md"
version="## $@"
version_prefix="## [0-9]{1,2}\."
start=0
CHANGE_LOG=""
while IFS= read line; do
if [[ $line == *"$version"* ]]; then
start=1
continue
start=1
continue
fi
if [[ $line =~ $version_prefix ]] && [ $start == 1 ]; then
break;
break;
fi
if [ $start == 1 ]; then
CHANGE_LOG+="$line\n"
CHANGE_LOG+="$line\n"
fi
done < ${change_log_file}
done < ${change_log_file}
LINUX_X86_64_BIN_SUM="$(checksum ./linux-x86_64-unknown-linux-gnu)"

LINUX_X86_64_BIN_SUM="$(checksum ./linux-x86_64-unknown-linux-gnu)"

OUTPUT=$(cat <<-END
## Changelog\n
${CHANGE_LOG}\n
## Checksums\n
| Assets | Sha256 Checksum |\n
| :-----------: |------------|\n
| thegarii-linux-x86-64 | ${LINUX_X86_64_BIN_SUM} |\n
OUTPUT="$(cat <<-END
## Changelog
${CHANGE_LOG}
## Checksums
|Assets | Checksum (sha256)|
|-|-|
|thegarii-linux-x86-64 | ${LINUX_X86_64_BIN_SUM}|
END
)
)"

echo -e "${OUTPUT}"
}

checksum() {
echo $(sha256sum $@ | awk '{print $1}')
}

echo -e ${OUTPUT}
main $@

0 comments on commit 538600b

Please sign in to comment.