Skip to content

Commit

Permalink
Add metadata-action so labels are generated
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Mogan <git@gavinmogan.com>
  • Loading branch information
halkeye committed Jun 6, 2024
1 parent 8c76aad commit 75d5ca9
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,28 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build main sliding sync image
if: github.ref_name == 'main'
id: docker_build_sliding_sync
uses: docker/build-push-action@v4
- name: Generate docker image tags
id: metadata
uses: docker/metadata-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: ${{ env.PLATFORMS }}
push: true
images: |
name=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
tags: |
ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:main
${{ github.ref_name == 'main' && 'type=raw,value=main' }}
${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && 'type=raw,value=latest' }}
type=raw,value=${{ github.ref_name }}
- name: Build release Sliding Sync image
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
id: docker_build_sliding_sync_release
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:latest
ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:${{ github.ref_name }}
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand Down

0 comments on commit 75d5ca9

Please sign in to comment.