Update cache #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update cache | |
on: | |
schedule: | |
# at 11:31 UTC (19:31 CST/UTC +8) on every Friday | |
# https://crontab.guru/#31_11_*_*_5 | |
- cron: "31 11 * * 5" | |
workflow_dispatch: | |
jobs: | |
update-cache: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
# https://cli.github.com/manual/gh_cache_list | |
# https://cli.github.com/manual/gh_cache_delete | |
- name: Delete setup-texlive-action caches | |
run: | | |
# to find why 'cache_keys' contain dup items | |
set -x | |
cache_keys=$(\ | |
gh cache list --key setup-texlive --json key --jq '.[].key') | |
if [[ $(wc -l <<< "$cache_keys") -gt 1 ]]; then | |
echo "Multiple setup-texlive-action caches found" | |
exit 1 | |
fi | |
for key in $cache_keys; do | |
echo "Deleting cache $key" | |
gh cache delete "$key" | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create new cache | |
uses: teatimeguest/setup-texlive-action@v3 | |
with: | |
package-file: .github/tl_packages | |
update-all-packages: true |