-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for weekly DockerHub cache cleanup
- Loading branch information
Alexey Pechnikov
committed
Feb 8, 2025
1 parent
83004e7
commit da01ef1
Showing
1 changed file
with
23 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Cleanup Docker Hub Cache | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
jobs: | ||
delete-cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get Docker Hub JWT Token | ||
run: | | ||
TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"username": "'"${{ secrets.DOCKER_USERNAME }}"'", "password": "'"${{ secrets.DOCKER_PASSWORD }}"'"}' | jq -r .token) | ||
echo "TOKEN=$TOKEN" >> $GITHUB_ENV | ||
- name: Delete cache tags from Docker Hub | ||
run: | | ||
curl -X DELETE -H "Authorization: JWT $TOKEN" \ | ||
"https://hub.docker.com/v2/repositories/pechnikov/pygmtsar/tags/cache-arm64/" | ||
curl -X DELETE -H "Authorization: JWT $TOKEN" \ | ||
"https://hub.docker.com/v2/repositories/pechnikov/pygmtsar/tags/cache-amd64/" |