2015-06-02 20:01:05 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2018-06-07 13:52:59 +03:00
|
|
|
publish_documentation() {
|
2019-11-15 01:56:24 +03:00
|
|
|
local version="$1"
|
2018-06-07 13:52:59 +03:00
|
|
|
local doc_dir="site"
|
|
|
|
local doc_branch="gh-pages"
|
|
|
|
|
|
|
|
git fetch origin "${doc_branch}:${doc_branch}"
|
|
|
|
git worktree add "$doc_dir" "$doc_branch"
|
|
|
|
pushd "$doc_dir"
|
|
|
|
|
|
|
|
git rm hub*.html >/dev/null
|
2019-10-31 03:40:36 +03:00
|
|
|
cp ../share/doc/*/*.html .
|
2020-01-21 16:13:17 +03:00
|
|
|
|
|
|
|
local tracking="$(sed -n '/googletagmanager/,/^<\/script/p' index.html)"
|
|
|
|
local man_page
|
|
|
|
for man_page in hub*.html; do cat <<<"$tracking" >>"$man_page"; done
|
|
|
|
|
2018-06-07 13:52:59 +03:00
|
|
|
git add hub*.html
|
2019-11-15 01:56:24 +03:00
|
|
|
GIT_COMMITTER_NAME='GitHub Actions' GIT_COMMITTER_EMAIL='mislav+actions@github.com' \
|
2018-06-07 13:52:59 +03:00
|
|
|
GIT_AUTHOR_NAME='Mislav Marohnić' GIT_AUTHOR_EMAIL='mislav@github.com' \
|
2019-11-15 01:56:24 +03:00
|
|
|
git commit -m "Update documentation for $version"
|
2018-06-07 13:52:59 +03:00
|
|
|
|
2020-01-21 17:17:51 +03:00
|
|
|
git push origin HEAD
|
2018-06-07 13:52:59 +03:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2019-01-18 21:00:39 +03:00
|
|
|
in_default_branch() {
|
|
|
|
git fetch origin master --depth 10
|
|
|
|
git merge-base --is-ancestor "$1" FETCH_HEAD
|
|
|
|
}
|
|
|
|
|
2019-11-15 01:56:24 +03:00
|
|
|
tag_name="${GITHUB_REF#refs/tags/}"
|
|
|
|
make man-pages
|
|
|
|
script/cross-compile "${tag_name#v}" | \
|
2020-03-05 21:12:14 +03:00
|
|
|
PATH="bin:$PATH" script/github-release "$tag_name"
|
2018-06-07 13:52:59 +03:00
|
|
|
|
2019-11-15 01:56:24 +03:00
|
|
|
if [[ $tag_name != *-* ]] && in_default_branch "$tag_name"; then
|
|
|
|
publish_documentation "$tag_name"
|
2015-06-02 20:01:05 +03:00
|
|
|
fi
|