mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-16 04:50:39 +01:00
Toujours créer un tag 'latest' pour la branche main
This commit is contained in:
64
.github/workflows/docker-build.yml
vendored
64
.github/workflows/docker-build.yml
vendored
@@ -1,53 +1,47 @@
|
|||||||
name: Build and Push
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ '**' ]
|
branches: ['*']
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Log in to the Container registry
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to Container Registry
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
if: github.event_name != 'pull_request'
|
id: meta
|
||||||
uses: docker/login-action@v3
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
username: ${{ github.actor }}
|
tags: |
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha,prefix={{branch}}-
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=raw,value={{branch}},enable=${{ github.ref_name != 'main' }}
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Build and push Docker image
|
||||||
id: meta
|
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||||
uses: docker/metadata-action@v5
|
with:
|
||||||
with:
|
context: .
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
type=ref,event=branch
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
Reference in New Issue
Block a user