generated from betagouv/template-nextjs
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (29 loc) · 1.04 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: 📦 Docker Image Build & Push
on:
push:
branches:
- "**"
jobs:
docker:
runs-on: ubuntu-latest
name: Build and push Docker image
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Inject enhanced GitHub environment variables
uses: rlespinasse/github-slug-action@v5
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/albert-docs:${{ env.GITHUB_REF_SLUG }}
${{ github.ref_name == 'main' && format('ghcr.io/{0}/albert-docs:latest', env.GITHUB_REPOSITORY_OWNER_PART_SLUG) || '' }}
cache-from: type=registry,ref=ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/albert-docs:${{ env.GITHUB_REF_SLUG }}
cache-to: type=inline