From 8aeb70e1bf8e1120199c95b6d81805a74a6c6bc9 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 7 Apr 2026 11:09:55 +0200 Subject: [PATCH] chore : add Gitea CI workflows and .claude settings - auto-tag-develop: auto version bump + tag on push to develop - build-docker: build & push Docker image to Gitea registry on tag - PR template - .claude/settings.json with project permissions Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/settings.json | 37 +++++++++++++++ .gitea/PULL_REQUEST_TEMPLATE.md | 23 ++++++++++ .gitea/workflows/auto-tag-develop.yml | 65 +++++++++++++++++++++++++++ .gitea/workflows/build-docker.yml | 30 +++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 .claude/settings.json create mode 100644 .gitea/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitea/workflows/auto-tag-develop.yml create mode 100644 .gitea/workflows/build-docker.yml diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..ec0f7d7 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,37 @@ +{ + "permissions": { + "allow": [ + "Bash(git status:*)", + "Bash(git add:*)", + "Bash(git commit:*)", + "Bash(git diff:*)", + "Bash(git checkout:*)", + "Bash(git push:*)", + "Bash(git pull:*)", + "Bash(git merge:*)", + "Bash(git tag:*)", + "Bash(git remote:*)", + "Bash(git stash:*)", + "Bash(git log:*)", + "Bash(git branch:*)", + "Bash(docker exec:*)", + "Bash(docker ps:*)", + "Bash(make start:*)", + "Bash(make stop:*)", + "Bash(make restart:*)", + "Bash(make install:*)", + "Bash(make dev-nuxt:*)", + "Bash(make shell:*)", + "Bash(make cache-clear:*)", + "Bash(make migration-migrate:*)", + "Bash(make db-reset:*)", + "Bash(make test:*)", + "Bash(make fixtures:*)", + "Bash(make php-cs-fixer-allow-risky:*)", + "Bash(chmod +x:*)", + "Skill(commit-commands:commit)", + "Skill(commit-commands:commit:*)", + "WebSearch" + ] + } +} diff --git a/.gitea/PULL_REQUEST_TEMPLATE.md b/.gitea/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..aed2bc5 --- /dev/null +++ b/.gitea/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +--- + +name: "Merge Request" +about: "Template de MR" +title: "[#NUMERO_TICKET] TITRE TICKET" +ref: "main" + +--- + +| Numéro du ticket | Titre du ticket | +|------------------|-----------------| +| | | + +## Description de la PR + +## Modification du .env + +## Check list + +- [ ] Pas de régression +- [ ] TU/TI/TF rédigée +- [ ] TU/TI/TF OK +- [ ] CHANGELOG modifié diff --git a/.gitea/workflows/auto-tag-develop.yml b/.gitea/workflows/auto-tag-develop.yml new file mode 100644 index 0000000..48f28d5 --- /dev/null +++ b/.gitea/workflows/auto-tag-develop.yml @@ -0,0 +1,65 @@ +name: Auto Tag Develop + +on: + push: + branches: + - develop + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.RELEASE_TOKEN }} + persist-credentials: true + + - name: Create next tag from config/version.yaml + shell: bash + run: | + set -euo pipefail + + # Skip if current commit already has a vX.Y.Z tag + if git tag --points-at HEAD | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "Tag already exists on this commit. Skipping." + exit 0 + fi + + changed_version=false + if git diff --name-only "${{ gitea.event.before }}" "${{ gitea.event.after }}" | grep -q '^config/version\.yaml$'; then + changed_version=true + fi + + read_version() { + awk -F': *' '/app\.version:/{print $2}' config/version.yaml | tr -d '[:space:]' | tr -d "'\"" + } + + if $changed_version; then + version="$(read_version)" + if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version in version.yaml: $version" >&2 + exit 1 + fi + else + last_tag="$(git tag -l 'v*' --sort=-v:refname | head -n1 || true)" + if [ -z "$last_tag" ]; then + version="0.1.0" + else + base="${last_tag#v}" + IFS='.' read -r major minor patch <<< "$base" + version="${major}.${minor}.$((patch + 1))" + fi + + printf "parameters:\\n app.version: '%s'\\n" "$version" > config/version.yaml + git config user.name "gitea-actions" + git config user.email "gitea-actions@local" + git add config/version.yaml + git commit -m "chore: bump version to v$version" || true + git push origin develop || true + fi + + tag="v$version" + git tag "$tag" + git push origin "$tag" diff --git a/.gitea/workflows/build-docker.yml b/.gitea/workflows/build-docker.yml new file mode 100644 index 0000000..43e08da --- /dev/null +++ b/.gitea/workflows/build-docker.yml @@ -0,0 +1,30 @@ +name: Build & Push Docker Image + +on: + push: + tags: + - "v*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Gitea Registry + run: | + echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.malio.fr -u "${{ gitea.repository_owner }}" --password-stdin + + - name: Build Docker image + run: | + docker build \ + -f infra/prod/Dockerfile \ + -t gitea.malio.fr/malio-dev/coltura:${{ gitea.ref_name }} \ + -t gitea.malio.fr/malio-dev/coltura:latest \ + . + + - name: Push Docker image + run: | + docker push gitea.malio.fr/malio-dev/coltura:${{ gitea.ref_name }} + docker push gitea.malio.fr/malio-dev/coltura:latest