Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make GH Actions less reliant on TL mirror availability
- Loading branch information
Showing
2 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Manually refresh caches | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repository: | ||
default: ctan | ||
description: 'Repository URL' | ||
required: false | ||
type: string | ||
delete-old: | ||
default: false | ||
description: 'Delete all caches' | ||
required: false | ||
type: boolean | ||
|
||
jobs: | ||
rebuild-cache: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Clean old caches | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO="${{ github.repository }}" | ||
BRANCH="${{ github.ref }}" | ||
HASH_KEY="texlive-0-${{ hashFiles(".github/tl_packages") }}-" | ||
DATE="$(date -I)" | ||
if ${{ inputs.delete-old }} | ||
then | ||
HASH_KEY="$HASH_KEY-$DATE" | ||
fi | ||
set +e | ||
gh actions-cache list -R "$REPO" -B "$BRANCH" --key "$HASH_KEY" | cut -f 1 | while read -r cacheKey | ||
do | ||
gh actions-cache delete "$cacheKey" -R "$REPO" -B "$BRANCH" --confirm | ||
done | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install TeX Live | ||
id: texlive | ||
uses: zauguin/install-texlive@v3 | ||
with: | ||
# List the required TeX Live packages in a separate file to allow reuse in | ||
# different workflows. | ||
accept-stale: false | ||
repository: ${{ inputs.repository }} | ||
package_file: .github/tl_packages |