blob: 5778e25ec8fd9023e6fd66743e8e78875d5396d9 [file] [log] [blame]
Varun Patile58bab22023-11-18 13:09:13 -08001name: Publish Docker image
2
3on:
4 push:
5 branches:
6 - master
Davide Pesavento6d4a6532023-11-18 17:05:33 -05007 paths-ignore:
8 - '*.md'
9 - '.mailmap'
Varun Patile58bab22023-11-18 13:09:13 -080010 workflow_dispatch:
11
Davide Pesavento6d4a6532023-11-18 17:05:33 -050012permissions:
13 contents: read
14 packages: write
15
Varun Patile58bab22023-11-18 13:09:13 -080016env:
17 REGISTRY: ghcr.io
18 IMAGE_NAME: ${{ github.repository }}
19
20jobs:
21 publish:
22 runs-on: ubuntu-latest
Varun Patile58bab22023-11-18 13:09:13 -080023 steps:
24 - name: Checkout repository
25 uses: actions/checkout@v4
26
27 - name: Login to ${{ env.REGISTRY }}
28 uses: docker/login-action@v3
29 with:
30 registry: ${{ env.REGISTRY }}
31 username: ${{ github.actor }}
32 password: ${{ secrets.GITHUB_TOKEN }}
33
Davide Pesavento6d4a6532023-11-18 17:05:33 -050034 - name: Extract metadata
Varun Patile58bab22023-11-18 13:09:13 -080035 id: meta
36 uses: docker/metadata-action@v5
37 with:
38 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
Davide Pesavento6d4a6532023-11-18 17:05:33 -050039 flavor: latest=true
Varun Patile58bab22023-11-18 13:09:13 -080040
41 - name: Build and push Docker image
42 uses: docker/build-push-action@v5
43 with:
44 context: .
45 pull: true
46 push: true
47 tags: ${{ steps.meta.outputs.tags }}
Davide Pesavento6d4a6532023-11-18 17:05:33 -050048 labels: ${{ steps.meta.outputs.labels }}