|
1 | 1 | name: Auto Tag and Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Temporarily manual-only for testing |
5 | | - # Uncomment 'push' below to enable automatic tagging on merge |
6 | | - # push: |
7 | | - # branches: |
8 | | - # - develop |
9 | | - # - main |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
10 | 7 | workflow_dispatch: |
11 | 8 | inputs: |
12 | 9 | force_services: |
@@ -102,23 +99,27 @@ jobs: |
102 | 99 | - name: Calculate new versions |
103 | 100 | id: versions |
104 | 101 | run: | |
105 | | - # Function to get latest tag and bump patch version |
| 102 | + # Function to get latest tag and bump build number (4th digit) |
106 | 103 | get_next_version() { |
107 | 104 | local prefix=$1 |
108 | 105 | local latest_tag=$(git tag -l "${prefix}/v*" | sort -V | tail -n1) |
109 | 106 | |
110 | 107 | if [ -z "$latest_tag" ]; then |
111 | | - # No tags exist, start with v0.1.0 |
112 | | - echo "v0.1.0" |
113 | | - else |
114 | | - # Extract version and bump patch |
115 | | - local version=${latest_tag##*/v} |
116 | | - local major=$(echo $version | cut -d. -f1) |
117 | | - local minor=$(echo $version | cut -d. -f2) |
118 | | - local patch=$(echo $version | cut -d. -f3) |
119 | | - local new_patch=$((patch + 1)) |
120 | | - echo "v${major}.${minor}.${new_patch}" |
| 108 | + # No tags exist - fail fast |
| 109 | + echo "ERROR: No existing tags found for prefix '${prefix}'. Please create an initial tag first." >&2 |
| 110 | + echo "Example: git tag ${prefix}/v0.1.0.0 && git push origin ${prefix}/v0.1.0.0" >&2 |
| 111 | + exit 1 |
121 | 112 | fi |
| 113 | + |
| 114 | + # Extract version and bump build number (4th digit) |
| 115 | + local version=${latest_tag##*/v} |
| 116 | + local major=$(echo $version | cut -d. -f1) |
| 117 | + local minor=$(echo $version | cut -d. -f2) |
| 118 | + local patch=$(echo $version | cut -d. -f3) |
| 119 | + local build=$(echo $version | cut -d. -f4) |
| 120 | + |
| 121 | + local new_build=$((build + 1)) |
| 122 | + echo "v${major}.${minor}.${patch}.${new_build}" |
122 | 123 | } |
123 | 124 | |
124 | 125 | # Calculate versions for each service |
|
0 commit comments