|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -e |
| 3 | + |
| 4 | +echo "Make sure you prepared your PC for automative deployment" |
| 5 | +echo "Release process: https://github.com/checkstyle/eclipse-cs/wiki/How-to-release" |
| 6 | + |
| 7 | +RELEASE=$1 |
| 8 | +PREV_RELEASE=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \ |
| 9 | + -t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//") |
| 10 | + |
| 11 | +echo "PREVIOUS RELEASE version:"$PREV_RELEASE |
| 12 | +echo "RELEASE version:"$RELEASE |
| 13 | + |
| 14 | +if [[ -z $RELEASE ]]; then |
| 15 | + echo "Please provide version as argument." |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | +if [[ -z $PREV_RELEASE ]]; then |
| 19 | + echo "Problem to calculate previous release version." |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +echo "Update the plugin/project versions to the new target version." |
| 24 | +mvn tycho-versions:set-version -DnewVersion="${RELEASE}-SNAPSHOT" |
| 25 | + |
| 26 | +echo "Update net.sf.eclipsecs.doc/src/main/resources/partials/index.html" |
| 27 | +echo " to reflect new release version and potentially the upgraded Checkstyle core version" |
| 28 | +sed -i "s/Latest release ${PREV_RELEASE}/Latest release ${RELEASE}/" \ |
| 29 | + net.sf.eclipsecs.doc/src/main/resources/partials/index.html |
| 30 | +sed -i "s/based on Checkstyle ${PREV_RELEASE%.*}/based on Checkstyle ${RELEASE%.*}/" \ |
| 31 | + net.sf.eclipsecs.doc/src/main/resources/partials/index.html |
| 32 | + |
| 33 | +echo "Create a new release notes partial page under" |
| 34 | +echo " net.sf.eclipsecs.doc/src/main/resources/partials/releases/ and fill it accordingly" |
| 35 | +mkdir net.sf.eclipsecs.doc/src/main/resources/partials/releases/${RELEASE} |
| 36 | +cp -r net.sf.eclipsecs.doc/src/main/templates/release_notes.html \ |
| 37 | + net.sf.eclipsecs.doc/src/main/resources/partials/releases/${RELEASE} |
| 38 | +git log --pretty=oneline --abbrev-commit $(git rev-list --tags --max-count=1)..HEAD \ |
| 39 | + | grep -vE "minor|doc|config|maven-release-plugin" \ |
| 40 | + | sed 's/^....... //' \ |
| 41 | + | sed 's/^/ <li>/g' \ |
| 42 | + | sed 's/$/<\/li>/g' > /tmp/release-notes-content.txt |
| 43 | +sed -i -e "/###CONTENT###/r /tmp/release-notes-content.txt" -e '/###CONTENT###/d' \ |
| 44 | + net.sf.eclipsecs.doc/src/main/resources/partials/releases/${RELEASE}/release_notes.html |
| 45 | + |
| 46 | +echo "Add the new release notes page in net.sf.eclipsecs.doc/src/main/resources/releases.json" |
| 47 | +cat <<EOT > /tmp/add-to-release.json |
| 48 | + { |
| 49 | + "version": "Release ${RELEASE}", |
| 50 | + "template": "partials/releases/${RELEASE}/release_notes.html", |
| 51 | + "open": true |
| 52 | + }, |
| 53 | +EOT |
| 54 | +sed -i "/\[/r /tmp/add-to-release.json" net.sf.eclipsecs.doc/src/main/resources/releases.json |
| 55 | + |
| 56 | +# deploy is manual till it tested |
| 57 | +exit 0; |
| 58 | + |
| 59 | +echo "Deploy binaries to bintray" |
| 60 | +mvn deploy -Pbintray |
| 61 | + |
| 62 | +echo "Commit/Push local changes to Git master branch," |
| 63 | +echo "this will also publish the project website (docs folder)" |
| 64 | +git add . |
| 65 | +git commit -m "config: release ${RELEASE}" |
| 66 | +git push origin master |
| 67 | + |
| 68 | +echo "Create release tag on latest commit, push tag to origin" |
| 69 | +git tag $RELEASE |
| 70 | +git push origin --tags |
0 commit comments