From 2996cf065e38cc0f42f50e7875c7b09609000655 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Fri, 12 Apr 2024 01:00:02 -0400 Subject: [PATCH] ci: switch to reusable workflow to publish Docker images Change-Id: Ia177e97401b0239822cc9814340c194974c611ea --- .github/workflows/docker.yml | 89 ++++++++++-------------------------- 1 file changed, 25 insertions(+), 64 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d21badde..172f8d2f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,71 +15,32 @@ on: permissions: packages: write - -env: - REGISTRY: ghcr.io + id-token: write jobs: + nfd-build: + uses: named-data/actions/.github/workflows/docker-image.yml@v1 + with: + name: nfd-build + target: build nfd: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - - name: Login to ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/nfd - flavor: latest=true - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - target: nfd - pull: true - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - + needs: nfd-build + uses: named-data/actions/.github/workflows/docker-image.yml@v1 + with: + name: nfd + target: nfd + contexts: build=docker-image://${{ needs.nfd-build.outputs.image }} + nfd-autoreg: + needs: nfd-build + uses: named-data/actions/.github/workflows/docker-image.yml@v1 + with: + name: nfd-autoreg + target: nfd-autoreg + contexts: build=docker-image://${{ needs.nfd-build.outputs.image }} nfd-status-http-server: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - - name: Login to ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/nfd-status-http-server - flavor: latest=true - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - target: nfd-status-http-server - pull: true - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + needs: nfd-build + uses: named-data/actions/.github/workflows/docker-image.yml@v1 + with: + name: nfd-status-http-server + target: nfd-status-http-server + contexts: build=docker-image://${{ needs.nfd-build.outputs.image }}