Skip to content
Amedee Van Gasse edited this page Nov 10, 2017 · 2 revisions
#!/bin/bash -e

case $# in
  3)
    COMMIT=$1
    RELEASE=$2
    DEVELOP=$3
    ;;
  *)
    echo "Usage: $0 COMMIT RELEASE DEVELOP"
    echo "Example: $0 18cf856c 7.0.1 7.0.2-SNAPSHOT"
    exit 1
esac

git checkout develop
(mvn -P release jgitflow:release-start \
    -DstartCommit="$COMMIT" \
    -DdevelopmentVersion="$DEVELOP" \
    -DreleaseVersion="$RELEASE" \
    -DallowSnapshots=true \
    -DallowUntracked=true \
    -DscmCommentPrefix="[RELEASE] " \
    -DautoVersionSubmodules=true ) || exit
find kernel -name Version.java | \
    xargs sed -i 's/String release = ".*"/String release = "'$RELEASE'"/'
find kernel -name Version.java | \
    xargs git add
git commit --amend -m "[RELEASE] $RELEASE-SNAPSHOT -> $RELEASE"
git checkout develop
find kernel -name Version.java | \
    xargs sed -i 's/String release = ".*"/String release = "'$DEVELOP'"/'
find kernel -name Version.java | \
    xargs git add
git commit --amend -m "[RELEASE] $RELEASE-SNAPSHOT -> $DEVELOP"
(mvn -P release jgitflow:release-finish \
    -DdevelopmentVersion="$DEVELOP" \
    -DreleaseVersion="$RELEASE" \
    -DautoVersionSubmodules=true \
    -DallowSnapshots=true \
    -DscmCommentPrefix="[RELEASE] " \
    -DtagMessage="iText 7 - $RELEASE\n\nhttps://github.com/itext/itext7/releases/tag/$RELEASE" \
    -DnoReleaseBuild=true \
    -DpushReleases=false) || true
find kernel -name Version.java | \
    xargs git checkout --theirs
find kernel -name Version.java | \
    xargs git add
git diff --name-only --diff-filter=U | xargs -r git checkout --ours
git diff --name-only --diff-filter=U | xargs -r git add
git commit --no-edit
git branch -D release/"$RELEASE"

# Update Version.java to next SNAPSHOT after the release.
git checkout develop
find kernel -name Version.java | \
    xargs sed -i 's/String release = ".*"/String release = "'$DEVELOP'"/'
find kernel -name Version.java | \
    xargs git add
git commit -m "[RELEASE] Set Version to $DEVELOP"

# Create zip file to add to release on GitHub
git checkout $RELEASE
mvn -P release clean install javadoc:aggregate-jar -Dmaven.test.skip=true
(cd ./target/ ; rm -f itext7-"$RELEASE".zip *.{pom,jar,md5,sha1,md})
find "$HOME"/.m2/repository/com/itextpdf/*/"$RELEASE"/ \( -name "*.pom" -o -name "*.jar" \) -print0 | xargs -0 cp -f -t ./target/
cp *.md ./target/
(cd ./target/ ;
  for file in *-"$RELEASE"*.{pom,jar}; do mv "$file" itext7-"$file"; done;
  for file in itext7-*-"$RELEASE"*.{pom,jar}; do md5sum "$file" > "$file".md5; done;
  for file in itext7-*-"$RELEASE"*.{pom,jar}; do sha1sum "$file" > "$file".sha1; done;
  for file in itext7-*-"$RELEASE"*.{jar,pom}; do gpg -ab $file; done
  zip -j -9 itext7-"$RELEASE".zip itext7-*-"$RELEASE"*.{pom,jar,asc,md5,sha1} *.md
) || exit
git checkout develop

#scp ./target/itext7-"$RELEASE".zip [email protected]:/home/domains/apps/default/files/itext7test
Clone this wiki locally