blob: 22d6c1c6a92ddc6cc6be78df6b29876a54126f1d [file] [log] [blame]
Davide Pesaventoc0993b02024-04-01 15:44:18 -04001name: Publish Docker images
Varun Patile58bab22023-11-18 13:09:13 -08002on:
3 push:
4 branches:
5 - master
Davide Pesavento6d4a6532023-11-18 17:05:33 -05006 paths-ignore:
Davide Pesaventoc0993b02024-04-01 15:44:18 -04007 - '.editorconfig'
8 - 'examples/**'
Davide Pesavento682b2af2024-02-23 21:25:41 -05009 - '.jenkins'
10 - '.jenkins.d/**'
Davide Pesavento6d4a6532023-11-18 17:05:33 -050011 - '.mailmap'
Davide Pesavento682b2af2024-02-23 21:25:41 -050012 - 'tests/**'
Varun Patile58bab22023-11-18 13:09:13 -080013 workflow_dispatch:
14
Davide Pesavento6d4a6532023-11-18 17:05:33 -050015permissions:
Davide Pesavento6d4a6532023-11-18 17:05:33 -050016 packages: write
17
Varun Patile58bab22023-11-18 13:09:13 -080018env:
19 REGISTRY: ghcr.io
Varun Patile58bab22023-11-18 13:09:13 -080020
21jobs:
22 publish:
23 runs-on: ubuntu-latest
Varun Patile58bab22023-11-18 13:09:13 -080024 steps:
Davide Pesaventoc0993b02024-04-01 15:44:18 -040025 - name: Set up Docker Buildx
26 uses: docker/setup-buildx-action@v3
Varun Patile58bab22023-11-18 13:09:13 -080027
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 Pesaventoc0993b02024-04-01 15:44:18 -040035 - name: Generate metadata for ndn-cxx-build image
36 id: build-meta
Varun Patile58bab22023-11-18 13:09:13 -080037 uses: docker/metadata-action@v5
38 with:
Davide Pesaventoc0993b02024-04-01 15:44:18 -040039 images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ndn-cxx-build
40 tags: |
41 type=ref,event=branch
42 type=raw,value=latest,enable={{is_default_branch}}
43 type=sha
44 env:
45 DOCKER_METADATA_ANNOTATIONS_LEVELS: index,manifest
Varun Patile58bab22023-11-18 13:09:13 -080046
Davide Pesaventoc0993b02024-04-01 15:44:18 -040047 - name: Build and push ndn-cxx-build image
Varun Patile58bab22023-11-18 13:09:13 -080048 uses: docker/build-push-action@v5
49 with:
Davide Pesaventoc0993b02024-04-01 15:44:18 -040050 build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
Varun Patile58bab22023-11-18 13:09:13 -080051 pull: true
52 push: true
Davide Pesaventoc0993b02024-04-01 15:44:18 -040053 target: build
54 tags: ${{ steps.build-meta.outputs.tags }}
55 labels: ${{ steps.build-meta.outputs.labels }}
56 annotations: ${{ steps.build-meta.outputs.annotations }}
57 cache-from: type=gha
58 cache-to: type=gha
59
60 - name: Generate metadata for ndn-cxx-runtime image
61 id: runtime-meta
62 uses: docker/metadata-action@v5
63 with:
64 images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ndn-cxx-runtime
65 tags: |
66 type=ref,event=branch
67 type=raw,value=latest,enable={{is_default_branch}}
68 type=sha
69 env:
70 DOCKER_METADATA_ANNOTATIONS_LEVELS: index,manifest
71
72 - name: Build and push ndn-cxx-runtime image
73 uses: docker/build-push-action@v5
74 with:
75 build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
76 pull: true
77 push: true
78 tags: ${{ steps.runtime-meta.outputs.tags }}
79 labels: ${{ steps.runtime-meta.outputs.labels }}
80 annotations: ${{ steps.runtime-meta.outputs.annotations }}
81 cache-from: type=gha
82 cache-to: type=gha