Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
044b64152c | ||
|
|
4de3ffa0e0 | ||
|
|
5bdf578de9 |
@@ -16,7 +16,7 @@ jobs:
|
|||||||
token: ${{ secrets.REGISTRY_TOKEN }}
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
|
|
||||||
- name: Create next tag from VERSION
|
- name: Create next tag from config/version.yaml
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -28,18 +28,18 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
changed_version=false
|
changed_version=false
|
||||||
if git diff --name-only "${{ gitea.event.before }}" "${{ gitea.event.after }}" | grep -q '^VERSION$'; then
|
if git diff --name-only "${{ gitea.event.before }}" "${{ gitea.event.after }}" | grep -q '^config/version\.yaml$'; then
|
||||||
changed_version=true
|
changed_version=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read_version() {
|
read_version() {
|
||||||
cat VERSION | tr -d '[:space:]'
|
awk -F': *' '/app\.version:/{print $2}' config/version.yaml | tr -d '[:space:]' | tr -d "'\""
|
||||||
}
|
}
|
||||||
|
|
||||||
if $changed_version; then
|
if $changed_version; then
|
||||||
version="$(read_version)"
|
version="$(read_version)"
|
||||||
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
echo "Invalid version in VERSION: $version" >&2
|
echo "Invalid version in version.yaml: $version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@@ -52,10 +52,10 @@ jobs:
|
|||||||
version="${major}.${minor}.$((patch + 1))"
|
version="${major}.${minor}.$((patch + 1))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$version" > VERSION
|
printf "parameters:\\n app.version: '%s'\\n" "$version" > config/version.yaml
|
||||||
git config user.name "gitea-actions"
|
git config user.name "gitea-actions"
|
||||||
git config user.email "gitea-actions@local"
|
git config user.email "gitea-actions@local"
|
||||||
git add VERSION
|
git add config/version.yaml
|
||||||
git commit -m "chore : bump version to v$version" || true
|
git commit -m "chore : bump version to v$version" || true
|
||||||
git push origin develop || true
|
git push origin develop || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
api_platform:
|
api_platform:
|
||||||
title: Inventory API
|
title: Inventory API
|
||||||
description: API de gestion d'inventaire industriel — machines, pièces, composants, produits.
|
description: API de gestion d'inventaire industriel — machines, pièces, composants, produits.
|
||||||
version: 1.9.1
|
version: 1.9.6
|
||||||
defaults:
|
defaults:
|
||||||
stateless: false
|
stateless: false
|
||||||
cache_headers:
|
cache_headers:
|
||||||
|
|||||||
2
config/version.yaml
Normal file
2
config/version.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
parameters:
|
||||||
|
app.version: '1.9.8'
|
||||||
@@ -19,7 +19,6 @@ COPY migrations migrations/
|
|||||||
COPY public public/
|
COPY public public/
|
||||||
COPY src src/
|
COPY src src/
|
||||||
COPY templates templates/
|
COPY templates templates/
|
||||||
COPY VERSION VERSION
|
|
||||||
|
|
||||||
RUN composer dump-autoload --optimize --no-dev
|
RUN composer dump-autoload --optimize --no-dev
|
||||||
|
|
||||||
@@ -31,6 +30,7 @@ COPY frontend/package.json frontend/package-lock.json ./
|
|||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
|
COPY config/version.yaml /app/config/version.yaml
|
||||||
ENV CI=1 \
|
ENV CI=1 \
|
||||||
NUXT_TELEMETRY_DISABLED=1 \
|
NUXT_TELEMETRY_DISABLED=1 \
|
||||||
NUXT_PUBLIC_API_BASE_URL=/api \
|
NUXT_PUBLIC_API_BASE_URL=/api \
|
||||||
|
|||||||
@@ -24,5 +24,5 @@ echo "==> Clearing cache..."
|
|||||||
sudo docker compose exec -T -u www-data app php bin/console cache:clear --env=prod
|
sudo docker compose exec -T -u www-data app php bin/console cache:clear --env=prod
|
||||||
sudo docker compose exec -T -u www-data app php bin/console cache:warmup --env=prod
|
sudo docker compose exec -T -u www-data app php bin/console cache:warmup --env=prod
|
||||||
|
|
||||||
VERSION=$(sudo docker compose exec -T app cat VERSION)
|
VERSION=$(sudo docker compose exec -T app cat config/version.yaml | grep 'app.version' | awk -F"'" '{print $2}')
|
||||||
echo "==> Deployed v${VERSION}"
|
echo "==> Deployed v${VERSION}"
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import { readFileSync } from 'node:fs'
|
|||||||
import { dirname, resolve } from 'node:path'
|
import { dirname, resolve } from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
// Lire la version depuis le fichier VERSION à la racine du projet parent
|
// Lire la version depuis config/version.yaml à la racine du projet parent
|
||||||
const getAppVersion = (): string => {
|
const getAppVersion = (): string => {
|
||||||
try {
|
try {
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
const versionPath = resolve(__dirname, '..', 'VERSION')
|
const versionPath = resolve(__dirname, '..', 'config', 'version.yaml')
|
||||||
return readFileSync(versionPath, 'utf-8').trim()
|
const content = readFileSync(versionPath, 'utf-8')
|
||||||
|
const match = content.match(/app\.version:\s*'([^']+)'/)
|
||||||
|
return match ? match[1] : '0.0.0'
|
||||||
} catch {
|
} catch {
|
||||||
return '0.0.0'
|
return '0.0.0'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ NC='\033[0m' # No Color
|
|||||||
# Répertoire racine du projet
|
# Répertoire racine du projet
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||||
VERSION_FILE="$PROJECT_ROOT/VERSION"
|
VERSION_FILE="$PROJECT_ROOT/config/version.yaml"
|
||||||
API_PLATFORM_FILE="$PROJECT_ROOT/config/packages/api_platform.yaml"
|
API_PLATFORM_FILE="$PROJECT_ROOT/config/packages/api_platform.yaml"
|
||||||
|
|
||||||
# Lire la version actuelle
|
# Lire la version actuelle
|
||||||
current_version=$(cat "$VERSION_FILE" | tr -d '\n')
|
current_version=$(awk -F': *' '/app\.version:/{print $2}' "$VERSION_FILE" | tr -d "' \n\r")
|
||||||
|
|
||||||
# Fonction pour afficher l'aide
|
# Fonction pour afficher l'aide
|
||||||
show_help() {
|
show_help() {
|
||||||
@@ -113,8 +113,8 @@ cd "$PROJECT_ROOT"
|
|||||||
# ===========================================
|
# ===========================================
|
||||||
# ÉTAPE 1 : Mettre à jour VERSION
|
# ÉTAPE 1 : Mettre à jour VERSION
|
||||||
# ===========================================
|
# ===========================================
|
||||||
echo -e "${BLUE}[1/4]${NC} Mise à jour du fichier VERSION..."
|
echo -e "${BLUE}[1/4]${NC} Mise à jour de config/version.yaml..."
|
||||||
echo "$new_version" > "$VERSION_FILE"
|
printf "parameters:\\n app.version: '%s'\\n" "$new_version" > "$VERSION_FILE"
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# ÉTAPE 2 : Mettre à jour api_platform.yaml
|
# ÉTAPE 2 : Mettre à jour api_platform.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user