From 2d96eafce4eb57bf74b58b4dd6fa3358670473ce Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Thu, 6 Apr 2023 15:04:27 +0200 Subject: [PATCH 1/3] add robot.txt/sitemap.xml add generation robot.txt/sitemap.xml files. --- .github/workflows/deploy.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 53710e19..2fcef455 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -106,6 +106,13 @@ jobs: run: | set -x + echo "User-agent: *" >/tmp/robot.txt + echo "Disallow:" >>/tmp/robot.txt + echo "Sitemap: https://docs.haproxy.org/sitemap.xml" >>/tmp/robot.txt + + echo "" >/tmp/sitemap.xml + echo "" >>/tmp/sitemap.xml + for branch in $BRANCHES; do printf "::group::Building %s\n" "$branch" if [ "$branch" = "dev" ]; then @@ -127,6 +134,13 @@ jobs: rm -rf "docs/$branch/" mkdir "docs/$branch/" + for n in "${files[@]}" + do + file=$(basename $n) + file=${file#*.txt} + echo "https://docs.haproxy.org/${$branch}/${file}" >>/tmp/sitemap.xml + done + env SOURCE_DATE_EPOCH="$LASTCHANGE" python3 dconv/dconv.py -g "$PWD/haproxy/" -o "$PWD/docs/$branch/" --base=.. ${files[@]} git add "docs/$branch/" @@ -136,6 +150,20 @@ jobs: printf "::endgroup::\n" done + echo "" >>/tmp/sitemap.xml + + cp /tmp/sitemap.xml docs/sitemap.txt + git add "docs/sitemap.txt" + if ! git diff --cached --quiet; then + git commit -m "Update sitemap.txt" + fi + + cp /tmp/robot.txt docs/robot.txt + git add "docs/robot.txt" + if ! git diff --cached --quiet; then + git commit -m "Update robot.txt" + fi + - name: Push the changes. run: | git push From 2c39923e9062648af77c39175db28e7281503d12 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Thu, 6 Apr 2023 15:08:09 +0200 Subject: [PATCH 2/3] fixe file variable filter --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2fcef455..ddeb6865 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -137,7 +137,7 @@ jobs: for n in "${files[@]}" do file=$(basename $n) - file=${file#*.txt} + file=${file%*.txt}.html echo "https://docs.haproxy.org/${$branch}/${file}" >>/tmp/sitemap.xml done From 946a568f3605e124abb8f44bb2601ed23c358426 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Thu, 6 Apr 2023 15:10:53 +0200 Subject: [PATCH 3/3] fix the sitemal file name from txt to xml --- .github/workflows/deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ddeb6865..73f6ba03 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -152,10 +152,10 @@ jobs: done echo "" >>/tmp/sitemap.xml - cp /tmp/sitemap.xml docs/sitemap.txt - git add "docs/sitemap.txt" + cp /tmp/sitemap.xml docs/sitemap.xml + git add "docs/sitemap.xml" if ! git diff --cached --quiet; then - git commit -m "Update sitemap.txt" + git commit -m "Update sitemap.xml" fi cp /tmp/robot.txt docs/robot.txt