Skip to content

Commit

Permalink
Merge pull request #6 from macpijan/rel_0.1.0
Browse files Browse the repository at this point in the history
Rel 0.1.0
  • Loading branch information
macpijan authored Dec 9, 2018
2 parents 4438f3b + b2dd468 commit 179d1a7
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ MAINTAINER Maciej Pijanowski <[email protected]>
RUN apk add git
RUN npm install -g auto-changelog

ADD VERSION .

ENTRYPOINT ["auto-changelog"]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
0.1.0
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

source name
source name.sh

docker build -t $DOCKER_USER_NAME/$DOCKER_IMAGE_NAME:latest .
2 changes: 0 additions & 2 deletions name

This file was deleted.

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

DOCKER_USER_NAME="macpijan"
DOCKER_IMAGE_NAME="auto-changelog"

CURRENT_VERSION="$(cat VERSION)"
echo "Current version: $CURRENT_VERSION"
5 changes: 3 additions & 2 deletions push.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

source name
source name.sh

echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USER" --password-stdin
docker push $DOCKER_USER_NAME/$DOCKER_IMAGE_NAME
docker push $DOCKER_USER_NAME/$DOCKER_IMAGE_NAME:latest
docker push $DOCKER_USER_NAME/$DOCKER_IMAGE_NAME:$CURRENT_VERSION
49 changes: 49 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

source name.sh

if [ $# -ne 1 ]; then
echo "Usage:"
echo "$0 BUMP"
echo "Available BUMPs: major, minor, patch"
exit 1
fi

BUMP="$1"

[ "$BUMP" != "major" -a \
"$BUMP" != "minor" -a \
"$BUMP" != "patch" ] && echo "Invalid BUMP" && exit 1

function errorCheck {
ERROR_CODE="$?"
if [ "$ERROR_CODE" -ne 0 ]; then
echo "[ERROR] $1 : ($ERROR_CODE)"
exit 1
fi
}

# ensure we're up to date
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
git fetch && git pull origin $CURRENT_BRANCH
errorCheck "Failed to pull $CURRENT_BRANCH"

# bump version
docker run --rm -v "$PWD":/app treeder/bump $BUMP
errorCheck "Failed to run \"treeder/bump\" container"

BUMPED_VERSION="$(cat VERSION)"
echo "Bumped version: $BUMPED_VERSION"

# tag
BRANCH="rel_$BUMPED_VERSION"
git checkout -b $BRANCH
errorCheck "Failed to create branch: \"$BRANCH\""
git commit -am "release $BUMPED_VERSION"
errorCheck "Failed to create commit"
git tag -a "$BUMPED_VERSION" -m "version $BUMPED_VERSION"
errorCheck "Failed to create tag: \"$BUMPED_VERSION\""
git push origin $BRANCH
errorCheck "Failed to push branch: \"$BRANCH\""
git push --tags
errorCheck "Failed to push tags"

0 comments on commit 179d1a7

Please sign in to comment.