@@ -79,19 +79,32 @@ jobs:
7979 matrix :
8080 site : ${{ fromJson(needs.setup_array.outputs.sites) }}
8181 steps :
82- - uses : actions/download-artifact@v8
82+ - name : Download run_id-${{ matrix.site }}
83+ uses : actions/download-artifact@v8
8384 with :
8485 name : run_id-${{ matrix.site }}
86+
8587 - name : Set $deploy_run_id
8688 run : echo "deploy_run_id=$(cat run_id.txt)" >> "$GITHUB_ENV"
89+
90+ - name : Delete run_id-${{ matrix.site }}
91+ run : |
92+ gh api /repos/originlab/originlab.github.io/actions/runs/$GITHUB_RUN_ID/artifacts \
93+ -q '.artifacts[] | select(.name == "run_id-${{ matrix.site }}") | .id' \
94+ | xargs -I {} gh api --method DELETE /repos/originlab/originlab.github.io/actions/artifacts/{}
95+
8796 - name : Watch the deployment
8897 run : gh run watch $deploy_run_id -R originlab/${{ matrix.site }} -i 10 --exit-status
98+
8999 - name : Set $build_job_id
90100 run : echo "build_job_id=$(gh run view $deploy_run_id -R originlab/${{ matrix.site }} | grep 'publish_book / convert' | grep -oP '\(ID \K\d+')" >> "$GITHUB_ENV"
91101
92- - name : Print converter output
102+ - name : Set $optimize_job_id
103+ run : echo "optimize_job_id=$(gh run view $deploy_run_id -R originlab/${{ matrix.site }} | grep 'publish_book / optimize' | grep -oP '\(ID \K\d+')" >> "$GITHUB_ENV"
104+
105+ - name : Summarize the converter run
93106 run : |
94- echo '# Converter output ' >> "$GITHUB_STEP_SUMMARY"
107+ echo '# Converter run ' >> "$GITHUB_STEP_SUMMARY"
95108 gh run view $deploy_run_id -j $build_job_id -R originlab/${{ matrix.site }} --log \
96109 | awk '/generator\.dll"/ {f=1} /upload-artifact/ {f=0} f' \
97110 | cut -f3- | cut -d' ' -f2- \
@@ -103,7 +116,22 @@ jobs:
103116 -e 's/^##\[warning\](.*)/> [!WARNING]\n> \1/g' \
104117 >> "$GITHUB_STEP_SUMMARY"
105118
106- - name : Print artifacts summary
119+ - name : Summarize the optimization run
120+ run : |
121+ echo '# Optimization run' >> "$GITHUB_STEP_SUMMARY"
122+ gh run view $deploy_run_id -j $optimize_job_id -R originlab/${{ matrix.site }} --log \
123+ | awk '/find pages\// {f=1} /upload-artifact/ {f=0} f' \
124+ | cut -f3- | cut -d' ' -f2- \
125+ | grep '##[warning]' \
126+ | sed -E \
127+ -e 's/\r//g' \
128+ -e 's/\^\[\[[0-9;]*[a-zA-Z]//g' \
129+ -e 's/^##\[group\](.*)/<details><summary>\1<\/summary><pre>/g' \
130+ -e 's/^##\[endgroup\]/<\/pre><\/details>/g' \
131+ -e 's/^##\[warning\](.*)/> [!WARNING]\n> \1/g' \
132+ >> "$GITHUB_STEP_SUMMARY"
133+
134+ - name : Summarize artifacts
107135 run : |
108136 echo '# Artifacts' >> "$GITHUB_STEP_SUMMARY"
109137 echo '| Name | Size |' >> "$GITHUB_STEP_SUMMARY"
@@ -115,9 +143,3 @@ jobs:
115143 else
116144 "| \(.name) | \((.size_in_bytes/1024/1024*10|round)/10) MB |"
117145 end' >> "$GITHUB_STEP_SUMMARY"
118-
119- - name : Clean up
120- run : |
121- gh api /repos/originlab/originlab.github.io/actions/runs/$GITHUB_RUN_ID/artifacts \
122- -q '.artifacts[] | select(.name == "run_id-${{ matrix.site }}") | .id' \
123- | xargs -I {} gh api --method DELETE /repos/originlab/originlab.github.io/actions/artifacts/{}
0 commit comments