Repository navigation
92 lines (80 loc) · 2.89 KB
/
Copy pathdocker-publish.yml
File metadata and controls
92 lines (80 loc) · 2.89 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# =============================================================================
# Publication Docker → ghcr.io/sannier3/iso-watcher
# =============================================================================
#
# Déclencheurs :
# - push sur main → tag :latest
# - push tag v* (v0.2.0) → tags 0.2.0, 0.2
# - pull_request main → build seulement (pas de push)
#
# Sur le serveur après push main :
# docker compose pull && docker compose up -d
#
# Node.js sur les runners GitHub Actions :
# Les actions JS (checkout, build-push, etc.) passent de Node 20 à Node 24.
# FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true évite les soucis avant juin 2026.
# L'image Docker de l'app reste Node 20 (Dockerfile node:20-bookworm-slim).
# =============================================================================
name: Docker
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/sannier3/iso-watcher
# Migration Actions Node 20 → 24 (https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/)
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: QEMU
uses: docker/setup-qemu-action@v3
- name: Buildx
uses: docker/setup-buildx-action@v3
- name: Connexion GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Métadonnées image (tags)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build et push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Résumé
if: github.event_name != 'pull_request'
run: |
echo "## Image publiée" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "${{ steps.meta.outputs.tags }}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "Sur le serveur : \`docker compose pull && docker compose up -d\`" >> "$GITHUB_STEP_SUMMARY"