Skip to content

Commit

Permalink
Add changelog script and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
divadsn committed Feb 25, 2018
1 parent 2a96046 commit c00a023
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine

RUN apk --no-cache add \
git \
bash

ADD changelog.sh /bin/
RUN chmod +x /bin/changelog.sh

ENTRYPOINT /bin/changelog.sh
23 changes: 23 additions & 0 deletions changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Whatever the fuck this was needed
# MERGE_PREFIX="Merge pull request"

if [ -z "$PLUGIN_OUTPUT" ]; then
PLUGIN_OUTPUT="changelog.txt"
fi

# Set commit range for git log, from previous commit to latest
GIT_COMMIT_RANGE="$DRONE_PREV_COMMIT_SHA..$DRONE_COMMIT_SHA"
GIT_COMMIT_LOG="$(git log --format='%s (by %cn)' $GIT_COMMIT_RANGE)"

# Parse log and output generated changelog to output file
echo "<b>Changelog for build ${MAJOR_MINOR}.${TRAVIS_BUILD_NUMBER}</b>${NEWLINE}" > $PLUGIN_OUTPUT

printf '%s\n' "$GIT_COMMIT_LOG" | while IFS= read -r line
do
echo "- ${line}" >> $PLUGIN_OUTPUT
done

# Print out Changelog
cat $PLUGIN_OUTPUT

0 comments on commit c00a023

Please sign in to comment.