Skip to content

Commit

Permalink
ci: switch to reusable workflow to publish Docker images
Browse files Browse the repository at this point in the history
Change-Id: Ia177e97401b0239822cc9814340c194974c611ea
  • Loading branch information
Pesa committed Apr 12, 2024
1 parent 01d0aa6 commit 2996cf0
Showing 1 changed file with 25 additions and 64 deletions.
89 changes: 25 additions & 64 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 2996cf0

Please sign in to comment.