[workflow] add clean ghcr to remove old dev imsages
This commit is contained in:
parent
b362647ef3
commit
58c6aa5702
1 changed files with 15 additions and 3 deletions
18
.github/workflows/on-push-main.yml
vendored
18
.github/workflows/on-push-main.yml
vendored
|
|
@ -15,14 +15,14 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Extract tag string
|
- name: Extract tag string
|
||||||
id: git
|
id: git
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
RELEASE_VERSION="dev-$(date +%s)"
|
RELEASE_VERSION="dev-$(date +%s)"
|
||||||
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
|
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ jobs:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
|
||||||
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
||||||
uses: docker/build-push-action@v4.1.1
|
uses: docker/build-push-action@v4.1.1
|
||||||
with:
|
with:
|
||||||
|
|
@ -53,3 +53,15 @@ jobs:
|
||||||
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
||||||
ghcr.io/${{ github.repository }}:development
|
ghcr.io/${{ github.repository }}:development
|
||||||
|
|
||||||
|
- name: Delete old dev images
|
||||||
|
uses: snok/container-retention-policy@v2
|
||||||
|
with:
|
||||||
|
image-names: gantry
|
||||||
|
cut-off: One day ago UTC
|
||||||
|
account-type: personal
|
||||||
|
token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }}
|
||||||
|
keep-at-least: 5
|
||||||
|
skip-tags: latest, development
|
||||||
|
filter-tags: "dev-*"
|
||||||
|
dry-run: False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue