Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 1 | name: Publish Docker images |
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: |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 7 | - '.editorconfig' |
| 8 | - 'examples/**' |
Davide Pesavento | 682b2af | 2024-02-23 21:25:41 -0500 | [diff] [blame] | 9 | - '.jenkins' |
| 10 | - '.jenkins.d/**' |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 11 | - '.mailmap' |
Davide Pesavento | 682b2af | 2024-02-23 21:25:41 -0500 | [diff] [blame] | 12 | - 'tests/**' |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 13 | workflow_dispatch: |
| 14 | |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 15 | permissions: |
Davide Pesavento | 6d4a653 | 2023-11-18 17:05:33 -0500 | [diff] [blame] | 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: |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 25 | - name: Set up Docker Buildx |
| 26 | uses: docker/setup-buildx-action@v3 |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 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 | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 35 | - name: Generate metadata for ndn-cxx-build image |
| 36 | id: build-meta |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 37 | uses: docker/metadata-action@v5 |
| 38 | with: |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 39 | 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 Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 46 | |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 47 | - name: Build and push ndn-cxx-build image |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 48 | uses: docker/build-push-action@v5 |
| 49 | with: |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 50 | build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 |
Varun Patil | e58bab2 | 2023-11-18 13:09:13 -0800 | [diff] [blame] | 51 | pull: true |
| 52 | push: true |
Davide Pesavento | c0993b0 | 2024-04-01 15:44:18 -0400 | [diff] [blame^] | 53 | 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 |