Skip to content

Commit fc857b2

Browse files
committed
Use actions/delete-package-versions to delete old images
1 parent 747a63c commit fc857b2

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

.github/workflows/docker.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ permissions:
66
packages: write
77

88
env:
9-
REGISTRY: ghcr.io
109
IMAGE_AUTHOR: mentalfs
1110
IMAGE_NAME: linuxserver-mods
1211

@@ -73,11 +72,11 @@ jobs:
7372
runs-on: ubuntu-latest
7473

7574
steps:
76-
- name: Prune old untagged images
77-
uses: vlaurin/[email protected]
75+
- name: Delete untagged images
76+
if: ${{ inputs.push }}
77+
uses: actions/delete-package-versions@v5
7878
with:
79-
token: ${{ secrets.PACKAGE_DELETE_TOKEN }}
80-
user: ${{ env.IMAGE_AUTHOR }}
81-
container: ${{ env.IMAGE_NAME }}
82-
dry-run: false
83-
prune-untagged: true
79+
package-name: ${{ env.IMAGE_NAME }}
80+
package-type: container
81+
delete-only-untagged-versions: 'true'
82+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/image.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ permissions:
1414
packages: write
1515

1616
env:
17-
REGISTRY: ghcr.io
1817
IMAGE_AUTHOR: mentalfs
1918
IMAGE_NAME: linuxserver-mods
2019

@@ -30,31 +29,29 @@ jobs:
3029
- name: Setup Docker buildx
3130
uses: docker/setup-buildx-action@v3
3231

33-
- name: Log into registry ${{ env.REGISTRY }}
32+
- name: Log into registry
3433
if: ${{ github.ref == 'refs/heads/main' }}
3534
uses: docker/login-action@v3
3635
with:
37-
registry: ${{ env.REGISTRY }}
36+
registry: ghcr.io
3837
username: ${{ github.actor }}
3938
password: ${{ secrets.GITHUB_TOKEN }}
4039

4140
- name: Extract Docker metadata
4241
id: meta
4342
uses: docker/metadata-action@v5
4443
with:
45-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}
44+
images: ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}
4645

47-
- name: Build and push it to ${{ env.REGISTRY }}
46+
- name: Build Docker image and push it
4847
id: build-and-push
4948
uses: docker/build-push-action@v5
5049
with:
5150
context: .
5251
build-args: MOD=${{ inputs.path }}
53-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}
52+
tags: ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}
5453
labels: ${{ steps.meta.outputs.labels }}
5554
provenance: false
5655
push: ${{ github.ref == 'refs/heads/main' }}
5756
cache-from: type=gha
5857
cache-to: type=gha,mode=max
59-
60-

0 commit comments

Comments
 (0)