Skip to content

Commit 5654444

Browse files
committed
fix typst caching too
with new cache we can't alway save the cache anymore without removing previous one. This means typst caching is way less efficient than designed initially. This change will allow to use the cache, but it will require manual update of the id to trigger a new caching
1 parent 544069c commit 5654444

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/actions/cache-typst/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ outputs:
99
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
1010
cache-matched-key:
1111
description: "Key of the cache found and used."
12-
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
12+
value: ${{ steps.cache-typst-restore.outputs.cache-matched-key }}
1313
cache-path:
1414
description: "where is the packages cache for typst ?"
1515
value: ${{ steps.cache-typst-path.outputs.TYPST_CACHE }}
@@ -22,20 +22,21 @@ runs:
2222
run: |
2323
case $RUNNER_OS in
2424
"Linux")
25-
echo "TYPST_CACHE=${XDG_CACHE_HOME:-~/.cache}/typst/packages/" >> $GITHUB_ENV
25+
typst_cache="${XDG_CACHE_HOME:-~/.cache}/typst/packages/"
2626
;;
2727
"macOS")
28-
echo "TYPST_CACHE=~/Library/Caches/typst/packages/" >> $GITHUB_ENV
28+
typst_cache="~/Library/Caches/typst/packages/"
2929
;;
3030
"Windows")
31-
echo "TYPST_CACHE=$LOCALAPPDATA/typst/packages/" >> $GITHUB_ENV
31+
typst_cache="$LOCALAPPDATA/typst/packages/"
3232
;;
3333
*)
3434
echo "$RUNNER_OS not supported"
3535
exit 1
3636
;;
3737
esac
38-
echo "TYPST_CACHE=${TYPST_CACHE}" >> $GITHUB_OUTPUT
38+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_ENV
39+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_OUTPUT
3940
shell: bash
4041

4142
- name: Cache Typst package folder

.github/workflows/test-smokes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ jobs:
293293
path: tests/timing-for-ci.txt
294294

295295
- name: Save Typst cache
296-
if: always()
296+
if: always() && steps.cache-typst.outputs.cache-hit != 'true'
297297
uses: actions/cache/save@v4
298298
with:
299299
key: ${{ steps.cache-typst.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)