|
26 | 26 | - name: Install dependencies |
27 | 27 | run: | |
28 | 28 | python -m pip install --upgrade pip setuptools==59.4.0 wheel tox |
| 29 | + - name: Setup local branches for docs build |
| 30 | + run: | |
| 31 | + git branch --track main origin/main || true |
| 32 | + git branch --track stable origin/stable || true |
29 | 33 | - name: Building docs (multiversion) |
30 | 34 | run: | |
31 | 35 | tox -e docs-multi |
@@ -82,28 +86,28 @@ jobs: |
82 | 86 | echo "The redirect file already exists." |
83 | 87 | exit 0 |
84 | 88 | fi |
85 | | - # If any of these commands fail, fail the build. |
86 | | - def_branch=$(gh api "repos/${GITHUB_REPOSITORY}" --jq ".default_branch") |
| 89 | + def_branch="stable" |
87 | 90 | html_url=$(gh api "repos/${GITHUB_REPOSITORY}/pages" --jq ".html_url") |
88 | | - # Beware ugly quotation mark avoidance in the foll lines. |
89 | | - echo '<!DOCTYPE html>' > index.html |
90 | | - echo '<html>' >> index.html |
91 | | - echo ' <head>' >> index.html |
92 | | - echo ' <title>Redirect to documentation</title>' >> index.html |
93 | | - echo ' <meta charset="utf-8">' >> index.html |
94 | | - echo ' <meta http=equiv="refresh" content="3; URL='${html_url}${def_branch}'/index.html">' >> index.html |
95 | | - echo ' <link rel="canonical" href="'${html_url}${def_branch}'/index.html">' >> index.html |
96 | | - echo ' <script language="javascript">' >> index.html |
97 | | - echo ' function redirect() {' >> index.html |
98 | | - echo ' window.location.assign("'${html_url}${def_branch}'/index.html")' >> index.html |
99 | | - echo ' }' >> index.html |
100 | | - echo ' </script>' >> index.html |
101 | | - echo ' </head>' >> index.html |
102 | | - echo ' <body onload="redirect()">' >> index.html |
103 | | - echo ' <p>Please follow the link to the <a href="'${html_url}${def_branch}'/index.html">' >> index.html |
104 | | - echo ${def_branch}'</a> branch documentation.</p>' >> index.html |
105 | | - echo ' </body>' >> index.html |
106 | | - echo '</html>' >> index.html |
| 91 | + cat > index.html << EOF |
| 92 | + <!DOCTYPE html> |
| 93 | + <html> |
| 94 | + <head> |
| 95 | + <title>Redirect to documentation</title> |
| 96 | + <meta charset="utf-8"> |
| 97 | + <meta http=equiv="refresh" content="3; URL="${html_url}${def_branch}/index.html" |
| 98 | + <link rel="canonical" href="'${html_url}${def_branch}/index.html"> |
| 99 | + <script language="javascript"> |
| 100 | + function redirect() { |
| 101 | + window.location.assign("${html_url}${def_branch}/index.html") |
| 102 | + } |
| 103 | + </script> |
| 104 | + </head> |
| 105 | + <body onload="redirect()"> |
| 106 | + <p>Please follow the link to the <a href="${html_url}${def_branch}/index.html"> |
| 107 | + ${def_branch}'</a> branch documentation.</p> |
| 108 | + </body> |
| 109 | + </html> |
| 110 | + EOF |
107 | 111 | git add index.html |
108 | 112 | - name: Commit changes to the GitHub Pages branch |
109 | 113 | run: | |
|
0 commit comments