Cleanup Container Registry #9
This file contains hidden or 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
| # .github/workflows/cleanup-ghcr.yml | |
| name: Cleanup Container Registry | |
| on: | |
| # Run this workflow automatically every Sunday at 02:00 UTC | |
| schedule: | |
| - cron: '0 2 * * 0' | |
| # Allow running this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| cleanup-images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| strategy: | |
| matrix: | |
| image-name: [stac-fastapi-pgstac-pair-search] # List of image names to clean up | |
| steps: | |
| - name: Delete old container image versions | |
| uses: snok/container-retention-policy@v2 | |
| with: | |
| image-names: ${{ matrix.image-name }} | |
| cut-off: One day ago UTC | |
| account-type: org | |
| org-name: eox-a | |
| keep-at-least: 5 | |
| skip-tags: '^(latest|\d+\.\d+(\.\d+)?|\d{4}\.\d{1,2}\.\d{1,2})$' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| token-type: github-token |