Skip to content

Commit

Permalink
chore: adding prepare-release script
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartorn committed Nov 6, 2019
1 parent da20ed4 commit 25f2c3a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ default: help; # default target
DOCKER_RUN = docker run --rm -v ${FOLDER}:/work -w /work --entrypoint bash -lc python-poetry:latest -c

IMAGE_NAME=python-poetry:latest
IMAGE_RELEASER_NAME=release-changelog:latest

prepare-release: build build-releaser ## Prepare release branch with changelog for given version
./release-script/prepare-release.sh
#docker build -t ${IMAGE_RELEASER_NAME} .
.PHONY: build

build-releaser: ## Build docker image for releaser
echo "Building Dockerfile"
docker build -f ./release-script/Dockerfile_changelog -t ${IMAGE_RELEASER_NAME} .
.PHONY: build

build: ## Build docker image
echo "Building Dockerfile"
Expand Down
7 changes: 7 additions & 0 deletions release-script/Dockerfile_changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:10.16.0-alpine@sha256:07897ec27318d8e43cfc6b1762e7a28ed01479ba4927aca0cdff53c1de9ea6fd

RUN apk add git

RUN npm i -g conventional-changelog-cli
RUN npm i -g conventional-github-releaser

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

# stop if error
set -e

read -p 'Release version: ' version
echo ${version} | grep v && echo "Version should be x.y.z (for example, 1.1.1, 2.0.0, ...)" && exit -1

localDir=`readlink -f .`
releaseDir="${localDir}/release-${version}"
rm -rf ${releaseDir}
mkdir ${releaseDir}
cd $releaseDir

echo "Cloning repo into tabnet"
git clone -q [email protected]:dreamquark-ai/tabnet.git tabnet

cd tabnet
# Create release branch and push it
git checkout -b release/${version}

# Change version of package
docker run --rm -v ${PWD}:/work -w /work python-poetry:latest poetry version ${version}
# Add modified file
git add pyproject.toml
# Commit release
git commit -m "chore: release v${version}"
# Create tag for changelog generation
git tag v${version}
docker run -v ${PWD}:/work -w /work --entrypoint "" release-changelog:latest conventional-changelog -p angular -i CHANGELOG.md -s -r 0
docker run -v ${PWD}:/work -w /work --entrypoint "" release-changelog:latest chmod 777 CHANGELOG.md
# Removing 4 first line of the file
echo "$(tail -n +4 CHANGELOG.md)" > CHANGELOG.md
# Deleting tag
git tag -d v${version}
# Adding CHANGELOG to commit
git add CHANGELOG.md
git commit --amend --no-edit
# Push release branch
git push origin release/${version}

cd ${localDir}
rm -rf ${releaseDir}

0 comments on commit 25f2c3a

Please sign in to comment.