@@ -35,32 +35,28 @@ jobs:
35
35
username : ${{ github.repository_owner }}
36
36
password : ${{ secrets.GITHUB_TOKEN }}
37
37
38
- - name : Build main sliding sync image
39
- if : github.ref_name == 'main'
40
- id : docker_build_sliding_sync
41
- uses : docker/build-push-action@v4
38
+ - name : Generate docker image tags
39
+ id : metadata
40
+ uses : docker/metadata-action@v5
42
41
with :
43
- cache-from : type=gha
44
- cache-to : type=gha,mode=max
45
- context : .
46
- platforms : ${{ env.PLATFORMS }}
47
- push : true
42
+ images : |
43
+ name=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
48
44
tags : |
49
- ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:main
45
+ ${{ github.ref_name == 'main' && 'type=raw,value=main' }}
46
+ ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && 'type=raw,value=latest' }}
47
+ type=raw,value=${{ github.ref_name }}
50
48
51
49
- name : Build release Sliding Sync image
52
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
53
50
id : docker_build_sliding_sync_release
54
51
uses : docker/build-push-action@v4
55
52
with :
56
53
cache-from : type=gha
57
54
cache-to : type=gha,mode=max
58
55
context : .
59
56
platforms : ${{ env.PLATFORMS }}
60
- push : true
61
- tags : |
62
- ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:latest
63
- ghcr.io/${{ env.GHCR_NAMESPACE }}/sliding-sync:${{ github.ref_name }}
57
+ push : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
58
+ tags : ${{ steps.metadata.outputs.tags }}
59
+ labels : ${{ steps.metadata.outputs.labels }}
64
60
65
61
- name : Run Trivy vulnerability scanner
66
62
uses : aquasecurity/trivy-action@master
0 commit comments