Build image with semver tags
This commit is contained in:
parent
d2b90e5368
commit
c6c792aa11
1 changed files with 14 additions and 5 deletions
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
|
|
@ -3,6 +3,7 @@ name: CI
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
|
@ -29,7 +30,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test
|
||||
if: ${{ github.repository_owner == 'sbidoul' && github.ref == 'refs/heads/main' }}
|
||||
if: ${{ github.repository_owner == 'sbidoul' && github.event_name == 'push' }}
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
|
@ -39,13 +40,21 @@ jobs:
|
|||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ github.repository }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.source=${{ github.event.repository.html_url }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest
|
||||
cache-to: type=inline
|
||||
push: true
|
||||
|
|
|
|||
Loading…
Reference in a new issue