25
25
26
26
27
27
# In the very unlikely cases where two PRs are merged, and the first 'doc' job is still running when the 2nd 'full-ci' starts,
28
- # make sure the first one is awaited. Even though docs are eventually overwritten, this ensures continuitiy in the doc repo history.
28
+ # make sure the first one is awaited. Even though docs are eventually overwritten, this ensures continuity in the doc repo history.
29
29
concurrency :
30
30
group : ' sync-doc'
31
31
cancel-in-progress : false
58
58
# For email address, see https://github.community/t/github-actions-bot-email-address/17204
59
59
# As search-index.js changes every time, even if source hasn't changed, this will not need 'git commit --allow-empty'
60
60
- name : " Prepare upload"
61
+ id : prepareUpload
61
62
run : |
62
63
mkdir ~/.ssh
63
64
echo '${{ secrets.DOC_DEPLOY_SSH_KEY }}' > ~/.ssh/id_rsa
@@ -72,25 +73,32 @@ jobs:
72
73
mv ${GITHUB_WORKSPACE}/target/doc/* .
73
74
mv ${GITHUB_WORKSPACE}/.github/workflows/doc/* .
74
75
75
- GDRUST_VERSION =$(grep -Po '^version = "\K[^"]*' ${GITHUB_WORKSPACE}/gdnative/Cargo.toml)
76
- GDRUST_SHORT_SHA =$(git rev-parse --short "${GITHUB_SHA}")
76
+ libVersion =$(grep -Po '^version = "\K[^"]*' ${GITHUB_WORKSPACE}/gdnative/Cargo.toml)
77
+ shortSha =$(git rev-parse --short "${GITHUB_SHA}")
77
78
78
- find gdnative -name .html -o -type f -print0 | xargs -0 sed -i 's/'"${GDRUST_VERSION} "'/master/g'
79
+ find gdnative -name .html -o -type f -print0 | xargs -0 sed -i 's/'"$libVersion "'/master/g'
79
80
80
- git add --all
81
- git commit -m "Sync doc from ${GDRUST_SHORT_SHA}
82
-
83
- Revision in godot-rust: ${GITHUB_SHA}"
81
+ if git diff --exit-code
82
+ then
83
+ echo "$shortSha introduces no doc changes; skip commit and push."
84
+ else
85
+ git add --all
86
+ git commit -m "Sync doc from $shortSha
87
+
88
+ Revision in godot-rust : ${GITHUB_SHA}"
89
+
90
+ echo ::set-output name=docsChanged::true
91
+ fi
84
92
85
93
- name : " Upload"
86
94
working-directory : doc
87
95
run : git push origin ${GDRUST_DOC_BRANCH}
96
+ if : ${{ steps.prepareUpload.outputs.docsChanged == 'true' }}
88
97
89
98
- name : " Cleanup"
90
99
run : shred -u ~/.ssh/id_rsa
91
100
92
101
93
-
94
102
# Possible alternative: dispatching a remote workflow
95
103
96
104
# - name: 'Dispatch remote workflow'
0 commit comments