diff --git a/.gitea/workflows/auto-tag-develop.yml b/.gitea/workflows/auto-tag-develop.yml
index 5bb4ac5..4c4a631 100644
--- a/.gitea/workflows/auto-tag-develop.yml
+++ b/.gitea/workflows/auto-tag-develop.yml
@@ -16,30 +16,53 @@ jobs:
token: ${{ secrets.RELEASE_TOKEN }}
persist-credentials: true
- - name: Create next tag v0.0.X
+ - name: Create next tag from config/version.yaml
shell: bash
run: |
set -euo pipefail
- # Skip if current commit already has a v0.0.* tag
- if git tag --points-at HEAD | grep -qE '^v0\.0\.'; then
+ # 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
- last_tag="$(git tag -l 'v0.0.*' --sort=-v:refname | head -n1 || true)"
- if [ -z "$last_tag" ]; then
- next_tag="v0.0.1"
- else
- patch="${last_tag##v0.0.}"
- if ! [[ "$patch" =~ ^[0-9]+$ ]]; then
- echo "Unexpected tag format: $last_tag" >&2
- exit 1
- fi
- next_tag="v0.0.$((patch + 1))"
+ changed_version=false
+ if git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" | grep -q '^config/version\.yaml$'; then
+ changed_version=true
fi
- git config user.name "gitea-actions"
- git config user.email "gitea-actions@local"
- git tag "$next_tag"
- git push origin "$next_tag"
+ 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
+
+ cat > config/version.yaml <
-
+
+
-
+
@@ -296,14 +297,6 @@
-
-
- 1768316835575
-
-
-
- 1768316835575
-
1768316965511
@@ -688,7 +681,15 @@
1770308927948
-
+
+
+ 1770310504254
+
+
+
+ 1770310504254
+
+
@@ -738,7 +739,6 @@
-
@@ -763,7 +763,8 @@
-
+
+
diff --git a/config/services.yaml b/config/services.yaml
index 1c52e92..5cfcb7a 100644
--- a/config/services.yaml
+++ b/config/services.yaml
@@ -8,6 +8,9 @@
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
+imports:
+ - { resource: version.yaml }
+
services:
# default configuration for services in *this* file
_defaults:
diff --git a/config/version.yaml b/config/version.yaml
new file mode 100644
index 0000000..acf5bfb
--- /dev/null
+++ b/config/version.yaml
@@ -0,0 +1,2 @@
+parameters:
+ app.version: '0.0.29'
diff --git a/src/Dto/AppVersion.php b/src/Dto/AppVersion.php
new file mode 100644
index 0000000..66f7dea
--- /dev/null
+++ b/src/Dto/AppVersion.php
@@ -0,0 +1,26 @@
+ ['version:read']],
+ provider: AppVersionProvider::class,
+ ),
+ ],
+ security: "is_granted('ROLE_USER')",
+)]
+final class AppVersion
+{
+ #[Groups(['version:read'])]
+ public string $version = '';
+}
diff --git a/src/State/AppVersionProvider.php b/src/State/AppVersionProvider.php
new file mode 100644
index 0000000..9f14f64
--- /dev/null
+++ b/src/State/AppVersionProvider.php
@@ -0,0 +1,26 @@
+version = $this->version;
+
+ return $dto;
+ }
+}