Skip to content

Commit

Permalink
ci: use docker/metadata-action
Browse files Browse the repository at this point in the history
Current approach is not robust to more complex branch names.

Related #4311 (comment).

Pull-Request: #4421.
  • Loading branch information
mxinden authored Sep 12, 2023
1 parent 92b5721 commit b8f47aa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Publish docker images
on:
push:
branches:
- '**'
- 'master'
tags:
- 'libp2p-server-**'
pull_request:

jobs:
server:
Expand All @@ -22,14 +23,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Get branch or tag name
id: ref-name
run: echo ::set-output name=ref::${GITHUB_REF#refs/*/}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}-server

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./misc/server/Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}-server:${{ steps.ref-name.outputs.ref }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit b8f47aa

Please sign in to comment.