Last active
January 21, 2017 10:43
-
-
Save fatso83/05280a7bcdbbb3f1df26f7e5c4e56fcc to your computer and use it in GitHub Desktop.
Skript for å generere en deploybeskrivelse i Octopus med Markdown-formatering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Skript for å generere en deploybeskrivelse i Octopus med HTML-formatering | |
if (( $# < 2 )); then | |
echo "Oppgi commitid-en tilsvarende siste deploy som første argument" | |
echo "Oppgi kjedenavn (ultra, meny, joker) som andre argument" | |
echo -e "Eksempel:\n\toctopus-description.sh 8f7c4f6 meny" | |
exit 1 | |
fi | |
github_base="https:\/\/github.com\/MWNG\/multikanal.epi7.$2" | |
github_commit="$github_base\/commit\/" | |
github_compare="$github_base\/compare\/" | |
function linkify_git_oneline(){ | |
sed -E \ | |
-e "s/^([[:alnum:]]+) (.*)/<li>\2 (<a href=\"$github_commit\1\">\1<\/a>)<\/li>/" | |
} | |
function linkify_commit_compare(){ | |
sed -E \ | |
-e "s/^([[:alnum:].]+)/<a href=\"$github_compare\1\">\1<\/a>/" | |
} | |
function last_commit(){ | |
git log --oneline -n1 | awk '{print $1}' | |
} | |
echo "<h3>Mest interessante endringer i denne releasen</h3>" | |
echo "<p>" | |
echo "<!-- denne seksjonen kan senere bli auto-utfylt fra seksjoner i committene -->" | |
echo " ------ FYLL INN ------" | |
echo "</p>" | |
echo "<details>" | |
echo -e "<summary>Ny kode siden forrige release ($(echo $1...$(last_commit) | linkify_commit_compare))</summary>\n" | |
echo "<ul>" | |
git log --oneline $1..| linkify_git_oneline | |
echo "</ul>" | |
echo "</details>" | |
echo -e "\n<a href="https://gist.github.com/05280a7bcdbbb3f1df26f7e5c4e56fcc">Auto-generert</a>" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Eksempeloutput
Mest interessante endringer siden forrige release (8f7c4f6...c8e3df9)