Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 1 | name: Publish Docker image |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - master |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 6 | paths-ignore: |
| 7 | - '*.md' |
Davide Pesavento | 682b2af | 2024-02-23 21:25:41 -0500 | [diff] [blame^] | 8 | - '.jenkins' |
| 9 | - '.jenkins.d/**' |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 10 | - '.mailmap' |
Davide Pesavento | 682b2af | 2024-02-23 21:25:41 -0500 | [diff] [blame^] | 11 | - 'tests/**' |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 12 | workflow_dispatch: |
| 13 | |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 14 | permissions: |
| 15 | contents: read |
| 16 | packages: write |
| 17 | |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 18 | env: |
| 19 | REGISTRY: ghcr.io |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 20 | |
| 21 | jobs: |
| 22 | publish: |
| 23 | runs-on: ubuntu-latest |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 24 | steps: |
| 25 | - name: Checkout repository |
| 26 | uses: actions/checkout@v4 |
| 27 | |
| 28 | - name: Login to ${{ env.REGISTRY }} |
| 29 | uses: docker/login-action@v3 |
| 30 | with: |
| 31 | registry: ${{ env.REGISTRY }} |
| 32 | username: ${{ github.actor }} |
| 33 | password: ${{ secrets.GITHUB_TOKEN }} |
| 34 | |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 35 | - name: Extract metadata |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 36 | id: meta |
| 37 | uses: docker/metadata-action@v5 |
| 38 | with: |
Davide Pesavento | 682b2af | 2024-02-23 21:25:41 -0500 | [diff] [blame^] | 39 | images: ${{ env.REGISTRY }}/${{ github.repository }} |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 40 | flavor: latest=true |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 41 | |
| 42 | - name: Build and push Docker image |
| 43 | uses: docker/build-push-action@v5 |
| 44 | with: |
| 45 | context: . |
| 46 | pull: true |
| 47 | push: true |
| 48 | tags: ${{ steps.meta.outputs.tags }} |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 49 | labels: ${{ steps.meta.outputs.labels }} |