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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
tags: ["v*"]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -29,7 +30,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- test
|
- test
|
||||||
if: ${{ github.repository_owner == 'sbidoul' && github.ref == 'refs/heads/main' }}
|
if: ${{ github.repository_owner == 'sbidoul' && github.event_name == 'push' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
@ -39,13 +40,21 @@ jobs:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
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
|
- name: Build image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
ghcr.io/${{ github.repository }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
labels: |
|
|
||||||
org.opencontainers.image.source=${{ github.event.repository.html_url }}
|
|
||||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest
|
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest
|
||||||
cache-to: type=inline
|
cache-to: type=inline
|
||||||
push: true
|
push: true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue