Skip to content

Commit

Permalink
Reuse metadata for test builds
Browse files Browse the repository at this point in the history
And don't add 'latest' tag manually - the action adds it automatically
  • Loading branch information
tpoliaw committed Dec 5, 2024
1 parent a3fcf3c commit acbc5b7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Generate Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Build image
uses: docker/build-push-action@v6
env:
Expand All @@ -26,7 +34,7 @@ jobs:
context: .
cache-from: type=gha
cache-to: type=gha
tags: ci_test
tags: ${{ steps.meta.outputs.tags }}
load: true

- name: Login to GHCR
Expand All @@ -37,15 +45,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Publish image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v6
Expand Down

0 comments on commit acbc5b7

Please sign in to comment.