Commit aa0c8822 authored by Anthony Gautreau's avatar Anthony Gautreau
Browse files

Mise à jour du release.sh

parent 76f087dd
Loading
Loading
Loading
Loading
+1 −0
Changes for api/src/Entity/Role.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM;

#[ApiResource(
    shortName: 'Role',
//    security: "is_granted('UNICAEN_PRIVILEGE', object)",
)]
#[ORM\Entity]
#[ORM\Table(name: '`unicaen_utilisateur_role`')]
+1 −0
Changes for api/src/Entity/User.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ use Unicaen\Utilisateur\State\UtilisateurPasswordHasherProcessor;
    openapi: new Operation(
        tags: ['unicaen_utilisateur_user Utilisateur'],
    ),
//    security: "is_granted('UNICAEN_PRIVILEGE', object)",
)]
#[ORM\Entity(repositoryClass: UtilisateurRepository::class)]
#[ORM\Table(name: '`unicaen_utilisateur_user`')]
+56 −9
Changes for release-api.sh: 56 added lines, 9 removed lines.
Original line number Diff line number Diff line
#!/bin/bash
# release-api.sh

VERSION="$1"
BUMP_TYPE="${1:-patch}" # patch | minor | major | default patch

if [ -z "$VERSION" ]; then
  echo "Usage: ./release-api.sh v1.2.3"
if [ -z "$BUMP_TYPE" ]; then
  echo "Usage: ./release-api.sh patch| minor | major"
  exit 1
fi

if ! command -v npm >/dev/null 2>&1; then
  echo "npm introuvable"; exit 1
fi

if ! command -v git >/dev/null 2>&1; then
  echo "git introuvable"; exit 1
fi

if [ ! -f frontend/package.json ]; then
  echo "Aucun package.json trouvé dans le dossier courant"; exit 1
fi

# Working tree clean ?
if ! git diff --quiet || ! git diff --cached --quiet; then
  echo "Votre working tree contient des changements non commités."
  echo "   Committez ou stash avant de lancer la release."
  exit 1
fi

# Récupérer les dernières versions
git fetch --tags origin

cd frontend || exit 1

# Construire la commande npm version
NPM_VERSION_CMD=(npm version "$BUMP_TYPE" -m "chore(release): v%s")

echo "Bump version avec: ${NPM_VERSION_CMD[*]}"
NEW_VERSION=$("${NPM_VERSION_CMD[@]}" | tr -d 'v')

echo "✅ Nouvelle version: $NEW_VERSION"
echo "✅ Nouveau tag: $TAG"

git add package.json

cd ..

echo "$NEW_VERSION" > api/.version
git add api/.version
git commit -m "Release: mise à jour version API $NEW_VERSION"

git push origin master

echo "Suppression éventuelle de la branche split-api locale..."
git branch -D split-api 2>/dev/null

echo "➡Génération split de /api pour version $VERSION..."
echo "Génération split de /api pour version $NEW_VERSION..."
git subtree split --prefix=api -b split-api

echo "Push de split-api vers origin..."
git push origin split-api --force

echo "Création du tag $VERSION sur split-api..."
git tag "$VERSION" split-api
echo "Création du tag $NEW_VERSION sur split-api..."
git tag -a "$NEW_VERSION" split-api
message=$(git tag -n --format='%(contents)' "$NEW_VERSION")

git push --tags origin split-api

echo "Push du tag $VERSION vers origin..."
git push origin "$VERSION"
echo "Push du tag $NEW_VERSION vers origin..."
git tag -a -m "$message" m-"$NEW_VERSION" master
git push --tags origin master

echo "✅ Release $VERSION terminée."
echo "Release $NEW_VERSION terminée."