diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 5fa5bf30aeb..d77e292da3b 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -170,6 +170,8 @@ jobs: # Restore the new doc dropping changes by "wipe out" (cd doc && git checkout --quiet -f HEAD~1) .github/workflows/create-changes-html.sh diff.txt doc + du -b diff.txt | cut -f1 > doc/DIFF_FILE_SIZE.txt + # note that the file above is generated after generating the diff, be careful to not contaminate the git diff # Sometimes rm -rf .git errors out because of some diehard hidden files # So we simply move it out of the doc directory (cd doc && mv .git ../git && mv .gitattributes ../gitattributes) diff --git a/.github/workflows/doc-publish.yml b/.github/workflows/doc-publish.yml index 8372841fbd6..c163fc5ec2e 100644 --- a/.github/workflows/doc-publish.yml +++ b/.github/workflows/doc-publish.yml @@ -27,6 +27,7 @@ permissions: jobs: publish-doc: runs-on: ubuntu-latest + needs: doc-html if: github.event.workflow_run.conclusion == 'success' env: CAN_DEPLOY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' }} @@ -52,6 +53,17 @@ jobs: - name: Extract doc run: unzip doc.zip -d doc if: steps.download-doc.outcome == 'success' + # WARNING: the folder structure is doc/doc/, so for example the CHANGES.html + # generated by doc-build.yml is at doc/doc/CHANGES.html + + - name: Read diff file size + id: read-diff-file-size + continue-on-error: true + run: | + cat doc/doc/DIFF_FILE_SIZE.txt # debug print + { printf 'result='; cat doc/doc/DIFF_FILE_SIZE.txt; } >> "$GITHUB_OUTPUT" + # note that the result will have type string! although "== 0" coerce to number, see + # https://docs.github.com/en/actions/reference/workflows-and-actions/expressions - name: Deploy to Netlify id: deploy-netlify @@ -75,7 +87,7 @@ jobs: header: preview-comment recreate: false message: | - [Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready! :tada: + [Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; ${{ steps.read-diff-file-size.outputs.result != 0 && format('[changes]({0}/CHANGES.html) is ready!', steps.deploy-netlify.outputs.NETLIFY_URL) || 'there is no change! ' }} :tada: This preview will update shortly after each push to this PR. if: steps.download-doc.outcome == 'success'