Files
Talks/.gitea/workflows/build-and-push.yaml
T
Le Prévost-Corvellec Arnault 2f5065bf37 Add Docker and Gitea workflow configurations for Talks slides deployment
- Introduced .dockerignore to exclude unnecessary files from Docker builds.
- Added build-and-push.yaml workflow for automated image building and Helm chart deployment on changes to specific paths.
- Created Dockerfile for building a static site with Nginx, including configuration for serving slides.
- Established Helm chart structure in talks-slides-dist for managing deployment configurations and resources.
- Removed outdated GitHub Actions workflows to streamline CI/CD processes.
2026-04-11 16:53:09 +02:00

129 lines
4.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Talks slides — image & chart
# Build image + chart quand le site statique (portail, decks, toolchain) ou l’infra change.
on:
push:
branches: [main, master, develop, cicd]
tags: ['v*']
paths:
- 'server/**'
- 'talks-slides-dist/**'
- '.gitea/workflows/**'
- 'portal/**'
- 'slides/**'
- 'tools/**'
- 'package.json'
- 'package-lock.json'
- '.dockerignore'
pull_request:
branches: [main, master, develop]
paths:
- 'server/**'
- 'talks-slides-dist/**'
- '.gitea/workflows/**'
- 'portal/**'
- 'slides/**'
- 'tools/**'
- 'package.json'
- 'package-lock.json'
- '.dockerignore'
env:
# GIT_DEFAULT_HASH: sha256
DOCKER_HOST: 'unix:///var/run/docker.sock'
DOCKER_CERT_PATH: '/certs/client'
IMAGE_REGISTRY: git.specificat.io
IMAGE_NAME: specificat.io/talks-slides
# Même registre OCI Helm que les autres charts (ex. knowledge-mcp).
HELM_OCI_REPOSITORY: oci://git.specificat.io/specificat.io
HELM_DIR: ./talks-slides-dist
jobs:
vars:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.out.outputs.version }}
steps:
- id: out
env:
RUN_NUMBER: ${{ github.run_number }}
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "version=${REF_NAME#v}" >> $GITHUB_OUTPUT
else
echo "version=0.0.${RUN_NUMBER}" >> $GITHUB_OUTPUT
fi
build-image:
runs-on: ubuntu-latest
name: Build container image
needs: vars
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: github.event_name == 'push'
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.CI_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Build and push image
if: github.event_name == 'push'
env:
VERSION: ${{ needs.vars.outputs.version }}
run: |
set -euo pipefail
IMAGE="${IMAGE_REGISTRY}/${IMAGE_NAME}:${VERSION}"
docker build -f server/Dockerfile -t "${IMAGE}" .
docker push "${IMAGE}"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag "${IMAGE}" "${IMAGE_REGISTRY}/${IMAGE_NAME}:latest"
docker push "${IMAGE_REGISTRY}/${IMAGE_NAME}:latest"
fi
- name: Build image (PR, no push)
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
docker build -f server/Dockerfile -t talks-slides:ci .
helm:
runs-on: ubuntu-latest
name: Helm chart
needs: vars
steps:
- uses: actions/checkout@v4
- name: Install Helm
run: |
set -euo pipefail
curl -fsSL -o helm.tgz --user "${{ secrets.CI_USER }}:${{ secrets.CI_TOKEN }}" \
"https://git.specificat.io/api/packages/Specificat.io/generic/helm/4.1.1/helm-v4.1.1-linux-amd64.tar.gz"
tar -xzf helm.tgz
sudo mv linux-amd64/helm /usr/local/bin/helm
helm version
# Chart publié avec le même tag que l’image (évite latest / oubli de --set au déploiement).
- name: Aligner slides.image.tag sur la version build
env:
VERSION: ${{ needs.vars.outputs.version }}
run: |
set -euo pipefail
f="${HELM_DIR}/values.yaml"
sed -i 's|^ tag: ".*"| tag: "'"${VERSION}"'"|' "$f"
grep -E '^ tag:' "$f" || true
- name: Helm lint & template
run: |
set -euo pipefail
helm lint "${HELM_DIR}"
helm template talks-slides "${HELM_DIR}"
- name: Package and push chart (OCI)
if: github.event_name == 'push'
env:
VERSION: ${{ needs.vars.outputs.version }}
run: |
set -euo pipefail
helm package "${HELM_DIR}" --version "${VERSION}" --app-version "${VERSION}"
helm registry login "${IMAGE_REGISTRY}" -u "${{ secrets.CI_USER }}" -p "${{ secrets.CI_TOKEN }}"
helm push "talks-slides-chart-${VERSION}.tgz" "${HELM_OCI_REPOSITORY}"