Skip to content

Commit

Permalink
Issue #5601: remove deploy to sourceforge.net from release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
romani committed Nov 30, 2018
1 parent 585c236 commit 12b58ab
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 61 deletions.
63 changes: 63 additions & 0 deletions .ci/copy-site-to-sourceforge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

set -e

PREV_RELEASE=$1
RELEASE=$2

echo "PREVIOUS RELEASE version:"$PREV_RELEASE
echo "RELEASE version:"$RELEASE

if [[ -z $RELEASE ]]; then
echo "Problem to calculate release version."
exit 1
fi
if [[ -z $PREV_RELEASE ]]; then
echo "Problem to calculate previous release version."
exit 1
fi

SF_USER=romanivanov
#############################
echo "Please provide password for $SF_USER,checkstyle@shell.sourceforge.net"
echo "exit" | ssh -t $SF_USER,checkstyle@shell.sourceforge.net create

#####

mkdir -p .ci-temp
cd .ci-temp
echo "Clone by ssh only to avoid passwords on push"
git clone git@github.com:checkstyle/checkstyle.github.io.git
sсp -R checkstyle.github.io $SF_USER,checkstyle@shell.sourceforge.net:/home/project-web/checkstyle/

#############################

ssh $SF_USER,checkstyle@shell.sourceforge.net << EOF
echo "Swap html content"
cd /home/project-web/checkstyle
mv htdocs htdocs-$PREV_RELEASE
mv checkstyle.github.io htdocs
ln -s /home/project-web/checkstyle/reports htdocs/reports
echo "restore folder with links to old releases"
mv htdocs-$PREV_RELEASE/version htdocs
echo "Archiving"
tar cfz htdocs-$PREV_RELEASE.tar.gz htdocs-$PREV_RELEASE/
mv htdocs-$PREV_RELEASE.tar.gz htdocs-archive/
rm -rf htdocs-$PREV_RELEASE/
echo "Extracting archive to previous releases documentation"
tar -xzvf htdocs-archive/htdocs-$PREV_RELEASE.tar.gz -C htdocs-version/ \
--exclude="*/apidocs" \
--exclude="*/xref" --exclude="*/xref-test" --exclude="*/cobertura" --exclude="*/dsm" \
--exclude="*/api" --exclude="reports" --exclude="jacoco" --exclude="dtds" \
--exclude="dependency-updates-report.html" --exclude="plugin-updates-report.html" \
--exclude="jdepend-report.html" --exclude="failsafe-report.html" \
--exclude="surefire-report.html" \
--exclude="linkcheck.html" --exclude="findbugs.html" --exclude="taglist.html" \
--exclude="releasenotes_old.html" --exclude="dependencies.html"
echo "Make a link to make it accessible from web"
ln -f -s htdocs-version/htdocs-$PREV_RELEASE htdocs/version/$PREV_RELEASE
EOF
16 changes: 1 addition & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@
<system>travis</system>
<url>https://travis-ci.org/checkstyle/checkstyle</url>
</ciManagement>
<distributionManagement>
<site>
<id>sourceforge-new-site</id>
<name>New Site</name>
<url>scp://shell.sourceforge.net/home/project-web/checkstyle/htdocs/new-site</url>
</site>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -985,15 +978,8 @@
<xdocDirectory>${basedir}/src/xdocs</xdocDirectory>
<!-- false till https://issues.apache.org/jira/browse/MSITE-774 -->
<validate>false</validate>
<skipDeploy>true</skipDeploy>
</configuration>
<dependencies>
<dependency>
<!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand Down
52 changes: 6 additions & 46 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e
echo "Make sure you prepared your PC for automative deployment"
echo "Release process: https://github.com/checkstyle/checkstyle/wiki/How-to-make-a-release"

SF_USER=romanivanov
RELEASE=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \
-t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//")
PREV_RELEASE=$(git describe --abbrev=0 $(git rev-list --tags --max-count=1) | sed "s/checkstyle-//")
Expand All @@ -21,72 +20,32 @@ if [[ -z $PREV_RELEASE ]]; then
exit 1
fi

#############################
echo "Please provide password for $SF_USER,checkstyle@shell.sourceforge.net"
echo "exit" | ssh -t $SF_USER,checkstyle@shell.sourceforge.net create

echo "Version bump in pom.xml"
echo "Version bump in pom.xml (release:prepare) ..."
SKIP_TEST="-DskipTests -DskipITs"
SKIP_CHECKSTYLE="-Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true"
SKIP_OTHERS="-Dpmd.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Dxml.skip=true"
mvn -e -Pgpg release:prepare -B -Darguments="$SKIP_TEST $SKIP_CHECKSTYLE $SKIP_OTHERS"

echo "Deployment of jars to maven central"
echo "and publication of site to https://checkstyle.org/new-site/"
echo "Deployment of jars to maven central (release:perform) ..."
mvn -e -Pgpg release:perform -Darguments="$SKIP_CHECKSTYLE"

#############################

ssh $SF_USER,checkstyle@shell.sourceforge.net << EOF
echo "Swap html content"
cd /home/project-web/checkstyle
mv htdocs/new-site/ .
mv htdocs htdocs-$PREV_RELEASE
mv new-site htdocs
ln -s /home/project-web/checkstyle/reports htdocs/reports
echo "restore folder with links to old releases"
mv htdocs-$PREV_RELEASE/version htdocs
echo "Archiving"
tar cfz htdocs-$PREV_RELEASE.tar.gz htdocs-$PREV_RELEASE/
mv htdocs-$PREV_RELEASE.tar.gz htdocs-archive/
rm -rf htdocs-$PREV_RELEASE/
echo "Extracting archive to previous releases documentation"
tar -xzvf htdocs-archive/htdocs-$PREV_RELEASE.tar.gz -C htdocs-version/ \
--exclude="*/apidocs" \
--exclude="*/xref" --exclude="*/xref-test" --exclude="*/cobertura" --exclude="*/dsm" \
--exclude="*/api" --exclude="reports" --exclude="jacoco" --exclude="dtds" \
--exclude="dependency-updates-report.html" --exclude="plugin-updates-report.html" \
--exclude="jdepend-report.html" --exclude="failsafe-report.html" \
--exclude="surefire-report.html" \
--exclude="linkcheck.html" --exclude="findbugs.html" --exclude="taglist.html" \
--exclude="releasenotes_old.html" --exclude="dependencies.html"
echo "Make a link to make it accessible from web"
ln -f -s htdocs-version/htdocs-$PREV_RELEASE htdocs/version/$PREV_RELEASE
EOF

##############################

echo "Go to folder where site was build and sources are already at required tag"
cd target/checkout

echo "Generate all binaries, no clean to keep site resources just in case"
echo "Generating uber jar ...(no clean to keep site resources just in case)"
mvn -e -Passembly package

echo "Come back repo folder"
cd ../../

##############################

echo "update github.io"
echo "Switch to checkstyle.github.io repository"
if [ -d "../checkstyle.github.io" ] ; then
cd ../checkstyle.github.io
else
cd ../
echo "Clone by ssh only to avoid passwords on push"
echo "Clone by ssh only to avoid passwords on push ..."
git clone git@github.com:checkstyle/checkstyle.github.io.git
cd checkstyle.github.io
fi
Expand All @@ -95,5 +54,6 @@ git checkout HEAD -- CNAME
cp -R ../checkstyle/target/checkout/target/site/* .
git add .
git commit -m "release $RELEASE"
echo "Push site content to remote ..."
echo "We do force to avoid history changes, we do not need history as github.io shows only HEAD."
git push origin --force

0 comments on commit 12b58ab

Please sign in to comment.