1- # Build and publish documentation
2-
31name : publish-prod
42
5- # Controls when the workflow will run
63on :
74 push :
85 branches :
@@ -15,54 +12,53 @@ jobs:
1512 runs-on : self-hosted
1613 env :
1714 PRODUCT : annotation
18- ROOT_DIR : docs-cloud-common
19- SRC_DIR : docs-cloud-common/public
20- DEST_DIR : /var/www/docs.groupdocs.cloud/html
15+ WORK_DIR : docs-cloud-common
16+ PUBLIC_DIR : docs-cloud-common/public
17+ REMOTE_DIR : /var/www/docs.groupdocs.cloud/html
2118
2219 steps :
2320 - uses : actions/checkout@v2
2421
2522 - name : Submodule update
2623 run : |
24+ rm -rf ${{ env.WORK_DIR }}
2725 git submodule update --init --recursive
2826 git submodule foreach git pull origin master
2927
30- - name : Install Hugo
28+ - name : Install tools
3129 run : |
3230 curl -LO https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_extended_0.101.0_Linux-64bit.deb
3331 sudo dpkg -i hugo_extended_0.101.0_Linux-64bit.deb
34-
35- - name : Install xmlstarlet
36- run : |
3732 sudo apt install xmlstarlet
3833
3934 - name : Run and build Hugo
4035 run : |
41- # echo ${{ env.ROOT_DIR }}
42- cp -r content/* ${{ env.ROOT_DIR }}/content/
43- hugo --source ${{ env.ROOT_DIR }} --minify --config config-geekdoc.toml
44- rootUrl=$(sed -n -e '/^baseURL/p' ${{ env.ROOT_DIR }}/config-geekdoc.toml | sed 's/baseURL//; s/\s*//g; s/=//; s/"//g')
45- # echo $rootUrl
36+ # Copy content
37+ cp -r content/* ${{ env.WORK_DIR }}/content/
38+ hugo --source ${{ env.WORK_DIR }} --minify --config config-geekdoc.toml
39+ # Read root URL from the config file
40+ rootUrl=$(sed -n -e '/^baseURL/p' ${{ env.WORK_DIR }}/config-geekdoc.toml | sed 's/baseURL//; s/\s*//g; s/=//; s/"//g')
41+ # Create pattern to search for `storage` or `total` pages
4642 pattern="//*[*[contains(text(),'${rootUrl}storage') or contains(text(),'${rootUrl}total')]]"
47- # echo $pattern
48- xmlstarlet ed --inplace -d "$pattern" ${{ env.SRC_DIR }}/product-sitemap.xml
49- # less ${{ env.SRC_DIR }}/product-sitemap.xml
43+ # Remove entries with `storage` and `total` substring
44+ xmlstarlet ed --inplace -d "$pattern" ${{ env.PUBLIC_DIR }}/product-sitemap.xml
5045
5146 - name : Deploy sitemap
52- uses : nogsantos/scp-deploy@master
47+ uses : burnett01/rsync-deployments@7.0.1
5348 with :
54- src : ${{ env.SRC_DIR }}/product-sitemap.xml
55- host : ${{ secrets.DOCS_SSH_HOST }}
56- remote : ${{ env.DEST_DIR }}/sitemaps/${{ env.PRODUCT }}.xml
57- user : ${{ secrets.DOCS_SSH_USER }}
58- key : ${{ secrets.DOCS_SSH_KEY }}
59-
49+ switches :
50+ path : ${{ env.PUBLIC_DIR }}/product-sitemap.xml
51+ remote_path : ${{ env.REMOTE_DIR }}/sitemaps/${{ env.PRODUCT }}.xml
52+ remote_host : ${{ secrets.DOCS_SSH_HOST }}
53+ remote_user : ${{ secrets.DOCS_SSH_USER }}
54+ remote_key : ${{ secrets.DOCS_SSH_KEY }}
55+
6056 - name : Deploy documentation
61- uses : nogsantos/scp-deploy@master
57+ uses : burnett01/rsync-deployments@7.0.1
6258 with :
63- src : ${{ env.SRC_DIR }}/${{ env.PRODUCT }}
64- host : ${{ secrets.DOCS_SSH_HOST }}
65- remote : ${{ env.DEST_DIR }}
66- user : ${{ secrets.DOCS_SSH_USER }}
67- key : ${{ secrets.DOCS_SSH_KEY }}
68-
59+ switches : -vzr --delete
60+ path : ${{ env.PUBLIC_DIR }}/${{ env.PRODUCT }}
61+ remote_path : ${{ env.REMOTE_DIR }}
62+ remote_host : ${{ secrets.DOCS_SSH_HOST }}
63+ remote_user : ${{ secrets.DOCS_SSH_USER }}
64+ remote_key : ${{ secrets.DOCS_SSH_KEY }}
0 commit comments