Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 1 | name: Publish Docker image |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 7 | paths-ignore: |
| 8 | - '*.md' |
| 9 | - '.mailmap' |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 10 | workflow_dispatch: |
| 11 | |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 12 | permissions: |
| 13 | contents: read |
| 14 | packages: write |
| 15 | |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 16 | env: |
| 17 | REGISTRY: ghcr.io |
| 18 | IMAGE_NAME: ${{ github.repository }} |
| 19 | |
| 20 | jobs: |
| 21 | publish: |
| 22 | runs-on: ubuntu-latest |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 23 | 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 Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 34 | - name: Extract metadata |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 35 | id: meta |
| 36 | uses: docker/metadata-action@v5 |
| 37 | with: |
| 38 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 39 | flavor: latest=true |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 40 | |
| 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 Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 48 | labels: ${{ steps.meta.outputs.labels }} |