Skip to content

Commit e46e015

Browse files
image: Use modern way of publishing the container
1 parent 5c35897 commit e46e015

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/image.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,36 @@ on:
1313
paths:
1414
- "Dockerfile"
1515
workflow_dispatch:
16+
env:
17+
REGISTRY: ghcr.io
18+
IMAGE_NAME: ${{ github.repository }}/gtk4
1619

1720
jobs:
1821
docker:
19-
runs-on: ubuntu-22.04
22+
permissions:
23+
contents: read
24+
packages: write
25+
runs-on: ubuntu-latest
2026
steps:
2127
- uses: actions/checkout@v4
22-
- name: Push to GitHub Packages
23-
uses: docker/build-push-action@v5
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
2431
with:
25-
push: ${{ github.event_name != 'pull_request' }}
32+
registry: ${{ env.REGISTRY }}
2633
username: ${{ github.actor }}
2734
password: ${{ secrets.GITHUB_TOKEN }}
28-
registry: ghcr.io
29-
repository: ${{ github.repository }}/gtk4
35+
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
44+
with:
45+
push: ${{ github.event_name != 'pull_request' }}
46+
context: .
3047
tags: latest
48+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)