@@ -157,33 +157,39 @@ cd code_docs/${REPO_NAME}
157
157
# both exist. This is a good indication that Doxygen did it's work.
158
158
if [ -d " html" ] && [ -f " html/index.html" ]; then
159
159
160
- echo ' Uploading documentation to the gh-pages branch...'
161
- # Add everything in this directory (the Doxygen code documentation) to the
162
- # gh-pages branch.
163
- # GitHub is smart enough to know which files have changed and which files have
164
- # stayed the same and will only update the changed files.
165
- echo ' Adding all files'
166
- git add --all
167
-
168
- if [ -n " $( git status --porcelain) " ]; then
169
- echo " Changes to commit"
170
- else
171
- echo " No changes to commit"
172
- exit 0
173
- fi
174
-
175
- # Commit the added files with a title and description containing the Travis CI
176
- # build number and the GitHub commit reference that issued this build.
177
- echo ' Git committing'
178
- git commit \
179
- -m " Deploy docs to GitHub Pages from commit ${COMMIT_SHA1: 0: 10} " \
180
- -m " Commit: ${COMMIT_SHA1} " $' \n ' " ${BUILD_ID} "
181
-
182
- # Force push to the remote gh-pages branch.
183
- # The output is redirected to /dev/null to hide any sensitive credential data
184
- # that might otherwise be exposed.
185
- echo ' Git pushing'
186
- git push --force " https://${AUTH} @github.com/${REPO_SLUG} .git" > /dev/null 2>&1
160
+ case " $GITHUB_REF_NAME " in
161
+ (main|master)
162
+ echo ' Uploading documentation to the gh-pages branch...'
163
+ # Add everything in this directory (the Doxygen code documentation) to the
164
+ # gh-pages branch.
165
+ # GitHub is smart enough to know which files have changed and which files have
166
+ # stayed the same and will only update the changed files.
167
+ echo ' Adding all files'
168
+ git add --all
169
+
170
+ if [ -n " $( git status --porcelain) " ]; then
171
+ echo " Changes to commit"
172
+ else
173
+ echo " No changes to commit"
174
+ exit 0
175
+ fi
176
+
177
+ # Commit the added files with a title and description containing the Travis CI
178
+ # build number and the GitHub commit reference that issued this build.
179
+ echo ' Git committing'
180
+ git commit \
181
+ -m " Deploy docs to GitHub Pages from commit ${COMMIT_SHA1: 0: 10} " \
182
+ -m " Commit: ${COMMIT_SHA1} " $' \n ' " ${BUILD_ID} "
183
+
184
+ # Force push to the remote gh-pages branch.
185
+ # The output is redirected to /dev/null to hide any sensitive credential data
186
+ # that might otherwise be exposed.
187
+ echo ' Git pushing'
188
+ git push --force " https://${AUTH} @github.com/${REPO_SLUG} .git" > /dev/null 2>&1
189
+ ;;
190
+ (* )
191
+ echo ' Not the main branch, not pushing documentation'
192
+ esac
187
193
else
188
194
echo ' ' >&2
189
195
echo ' Warning: No documentation (html) files have been found!' >&2
0 commit comments