[doc] Fix urls for documentation

- Don't publish the doc anymore to pmd.github.io - the docs are now hosted at docs.pmd-code.org
- Update sitemap.xml - no extra sitemap generation anymore
This commit is contained in:
Andreas Dangel 2023-03-30 12:35:21 +02:00
parent 1c0d6c6a4f
commit 910d3178db
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
5 changed files with 26 additions and 115 deletions

View File

@ -224,7 +224,7 @@ function pmd_ci_build_and_upload_doc() {
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then
# only for snapshot builds from branch master
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
# update github pages https://pmd.github.io/pmd/
@ -249,14 +249,12 @@ function pmd_ci_build_and_upload_doc() {
local rendered_release_notes_with_links
rendered_release_notes_with_links="
* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${PMD_CI_MAVEN_PROJECT_VERSION}
* Documentation: https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/
* Documentation: https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/
${rendered_release_notes}"
pmd_ci_sourceforge_createDraftBlogPost "${release_name} released" "${rendered_release_notes_with_links}" "pmd,release"
SF_BLOG_URL="${RESULT}"
# updates https://pmd.github.io/latest/ and https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}
publish_release_documentation_github
# rsync site to https://pmd.sourceforge.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}
pmd_ci_sourceforge_rsyncSnapshotDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}"
fi

View File

@ -42,55 +42,7 @@ function pmd_doc_create_archive() {
}
#
# Publishes the site to https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION} and
# https://pmd.github.io/latest/
#
function publish_release_documentation_github() {
echo -e "\n\n"
pmd_ci_log_info "Adding the new doc to pmd.github.io..."
# clone pmd.github.io. Note: This uses the ssh key setup earlier
# In order to speed things up, we use a sparse checkout - no need to checkout all directories here
mkdir pmd.github.io
(
cd pmd.github.io || { echo "Directory 'pmd.github.io' doesn't exist"; exit 1; }
git init
git config user.name "PMD CI (pmd-bot)"
git config user.email "pmd-bot@users.noreply.github.com"
git config core.sparsecheckout true
git remote add origin git@github.com-pmd.github.io:pmd/pmd.github.io.git
echo "/latest/" > .git/info/sparse-checkout
echo "/sitemap.xml" >> .git/info/sparse-checkout
git pull --depth=1 origin master
pmd_ci_log_info "Copying documentation from ../docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/ to pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/ ..."
rsync -ah --stats "../docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/" "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/"
git status
pmd_ci_log_debug "Executing: git add pmd-${PMD_CI_MAVEN_PROJECT_VERSION}"
git add --sparse "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}"
pmd_ci_log_debug "Executing: git commit..."
git commit -q -m "Added pmd-${PMD_CI_MAVEN_PROJECT_VERSION}"
pmd_ci_log_info "Copying pmd-${PMD_CI_MAVEN_PROJECT_VERSION} to latest ..."
git rm -qr latest
cp -a "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" latest
pmd_ci_log_debug "Executing: git add latest"
git add latest
pmd_ci_log_debug "Executing: git commit..."
git commit -q -m "Copying pmd-${PMD_CI_MAVEN_PROJECT_VERSION} to latest"
pmd_ci_log_info "Generating sitemap.xml"
../docs/sitemap_generator.sh > sitemap.xml
pmd_ci_log_debug "Executing: git add sitemap.xml"
git add sitemap.xml
pmd_ci_log_debug "Executing: git commit..."
git commit -q -m "Generated sitemap.xml"
pmd_ci_log_info "Executing: git push origin master"
git push origin master
)
}
#
# Updates github pages of the main repository,
# Updates github pages branch "gh-pages" of the main repository,
# so that https://pmd.github.io/pmd/ has the latest (snapshot) content
#
function pmd_doc_publish_to_github_pages() {

View File

@ -44,7 +44,6 @@ exclude:
- pdf-*.sh
- pdfconfigs/
- pdf/
- sitemap_generator.sh
- render_release_notes.rb
feedback_subject_line: PMD Source Code Analyzer
@ -117,7 +116,7 @@ description: "Intended as a documentation theme based on Jekyll for technical wr
# the description is used in the feed.xml file
# needed for sitemap.xml file only
url: https://pmd.github.io/pmd
url: https://docs.pmd-code.org/latest
baseurl: ""
# used by javadoc_tag.rb

View File

@ -1,23 +1,41 @@
---
layout: none
search: exclude
# https://www.sitemaps.org/protocol.html
# Priority is relative to the website, can be chosen in {0.1, 0.2, ..., 1}
# Default priority is 0.5
latestPriority: 0.8
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>{{site.url}}/index.html</loc>
<priority>0.9</priority>
<changefreq>monthly</changefreq>
<lastmod>{{ site.time | date: "%Y-%m-%d" }}</lastmod>
</url>
{% for post in site.posts %}
{% unless post.search == "exclude" %}
<url>
<loc>{{site.url}}{{post.url}}</loc>
<priority>{{page.latestPriority}}</priority>
<changefreq>monthly</changefreq>
<lastmod>{{ site.time | date: "%Y-%m-%d" }}</lastmod>
</url>
{% endunless %}
{% endfor %}
{% for page in site.pages %}
{% unless page.search == "exclude" %}
{% for p in site.pages %}
{% unless p.search == "exclude" %}
<url>
<loc>{{site.url}}{{ page.url}}</loc>
<loc>{{site.url}}{{ p.url}}</loc>
<priority>{{page.latestPriority}}</priority>
<changefreq>monthly</changefreq>
<lastmod>{{ site.time | date: "%Y-%m-%d" }}</lastmod>
</url>
{% endunless %}
{% endfor %}

View File

@ -1,56 +0,0 @@
#!/usr/bin/env bash
# Sitemap generator for pmd.github.io main landing page.
# Assumes we have the latest version of the site under "latest"
# https://www.sitemaps.org/protocol.html
WEBSITE_PREFIX="https://pmd.github.io/"
DOC_PREFIX="latest/"
DATE=`date +%Y-%m-%d`
# Priority is relative to the website, can be chosen in {0.1, 0.2, ..., 1}
# Default priority is 0.5
LATEST_PRIORITY=0.8
# Writes to standard output
cat << HEADER_END
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>${WEBSITE_PREFIX}index.html</loc>
<priority>1</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
<url>
<loc>${WEBSITE_PREFIX}${DOC_PREFIX}index.html</loc>
<priority>0.9</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
HEADER_END
for page in ${DOC_PREFIX}pmd_*.html
do
cat << ENTRY_END
<url>
<loc>${WEBSITE_PREFIX}$page</loc>
<priority>$LATEST_PRIORITY</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
ENTRY_END
done
echo "</urlset>"