Skip to content

Commit

Permalink
docs: Automatically update the changelog on the website on release
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Jul 18, 2023
1 parent 9b17779 commit c57771a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
4 changes: 0 additions & 4 deletions devtools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ else
fi

# ----------------------------------------------------------------------------------------------------
## Update the top of the CHANGELOG.md and website frontpage
vim documentation/content/_index.md
git commit -m"docs: Updated website after release" documentation/content/_index.md

warn "Now go and manually push it all"

# ----------------------------------------------------------------------------------------------------
Expand Down
43 changes: 43 additions & 0 deletions documentation/UpdateVersionWebsiteHomepage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# Yet Another UserAgent Analyzer
# Copyright (C) 2013-2023 Niels Basjes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
TARGETFILE="${SCRIPTDIR}/../documentation/content/_index.md"
VERSION="${1}"

if [[ "$VERSION" == *"-SNAPSHOT"* ]];
then
echo "Skipping: $VERSION is a SNAPSHOT version."
exit 0
fi

if grep "Version v${VERSION}"'$' "$TARGETFILE" > /dev/null ;
then
echo "Skipping: $VERSION is already on homepage."
exit 0
fi

echo "Updating version on website to: $VERSION"

sed -i "s@### NEXT RELEASE@### NEXT RELEASE\n\
- New/improved detections:\n\
- ...\n\
\n\
### Version v${VERSION}@g" "$TARGETFILE"

git add "$TARGETFILE"
15 changes: 14 additions & 1 deletion documentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>Update website to show the released version.</id>
<id>Update website to show the released version (Code).</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
Expand All @@ -74,6 +74,19 @@
</arguments>
</configuration>
</execution>
<execution>
<id>Update website to show the released version (Homepage).</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./UpdateVersionWebsiteHomepage.sh</executable>
<arguments>
<argument>${project.version}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down

0 comments on commit c57771a

Please sign in to comment.