Skip to content

Commit

Permalink
fix(.github/docker-image): 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.

See context in #4311 (comment)
  • Loading branch information
mxinden committed Sep 1, 2023
1 parent b9028e8 commit 4628e7e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,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 }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 4628e7e

Please sign in to comment.