Skip to content

Commit f70e579

Browse files
committed
fixed version set/increment in profile release
1 parent 32d0573 commit f70e579

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

.github/workflows/profile-release.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,9 @@ jobs:
7878
echo "deploy=${{ github.event.inputs.deploy }}" >> $GITHUB_OUTPUT
7979
echo "release_track=${{ github.event.inputs.release_track }}" >> $GITHUB_OUTPUT
8080
81-
# For manual dispatch, use current commit or branch for version
82-
if [ "${{ github.event.inputs.build_type }}" == "release" ]; then
83-
# Try to get version from latest tag
84-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
85-
echo "version=$LATEST_TAG" >> $GITHUB_OUTPUT
86-
else
87-
echo "version=dev" >> $GITHUB_OUTPUT
88-
fi
81+
# Always get version from latest Git tag (never use "manual" or "dev")
82+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
83+
echo "version=$LATEST_TAG" >> $GITHUB_OUTPUT
8984
9085
echo "is_release=${{ github.event.inputs.build_type == 'release' }}" >> $GITHUB_OUTPUT
9186
echo "version_code=${{ github.event.inputs.version_code }}" >> $GITHUB_OUTPUT
@@ -230,7 +225,6 @@ jobs:
230225
echo "✅ All required files found for profile: ${{ needs.detect-release.outputs.profile }}"
231226
232227
- name: Update versions from tag
233-
if: needs.detect-release.outputs.is_release == 'true'
234228
run: |
235229
VERSION="${{ needs.detect-release.outputs.version }}"
236230
@@ -241,9 +235,9 @@ jobs:
241235
VERSION_NUMBER="$VERSION"
242236
fi
243237
244-
# Handle special cases
245-
if [ "$VERSION_NUMBER" == "dev" ]; then
246-
VERSION_NUMBER="1.0.0-dev"
238+
# Never use "dev" - always use a proper version number
239+
if [ "$VERSION_NUMBER" == "dev" ] || [ -z "$VERSION_NUMBER" ]; then
240+
VERSION_NUMBER="1.0.0"
247241
fi
248242
249243
echo "📝 Updating versions to: $VERSION_NUMBER"
@@ -253,23 +247,23 @@ jobs:
253247
CURRENT_BUILD_NUMBER=$(grep "IOS_BUILD_NUMBER=" ./profile-config/.env | cut -d'=' -f2 || echo "0")
254248
255249
# Increment build numbers (or use manual override)
256-
if [ -n "${{ needs.detect-release.outputs.version_code }}" ]; then
250+
if [ -n "${{ needs.detect-release.outputs.version_code }}" ] && [ "${{ needs.detect-release.outputs.version_code }}" != "" ]; then
257251
NEW_VERSION_CODE="${{ needs.detect-release.outputs.version_code }}"
258252
else
259253
NEW_VERSION_CODE=$((CURRENT_VERSION_CODE + 1))
260254
fi
261255
262-
if [ -n "${{ needs.detect-release.outputs.build_number }}" ]; then
256+
if [ -n "${{ needs.detect-release.outputs.build_number }}" ] && [ "${{ needs.detect-release.outputs.build_number }}" != "" ]; then
263257
NEW_BUILD_NUMBER="${{ needs.detect-release.outputs.build_number }}"
264258
else
265259
NEW_BUILD_NUMBER=$((CURRENT_BUILD_NUMBER + 1))
266260
fi
267261
268-
# Update .env file with new versions
269-
sed -i "s/ANDROID_VERSION_CODE=.*/ANDROID_VERSION_CODE=$NEW_VERSION_CODE/" ./profile-config/.env
270-
sed -i "s/ANDROID_VERSION_NAME=.*/ANDROID_VERSION_NAME=$VERSION_NUMBER/" ./profile-config/.env
271-
sed -i "s/IOS_VERSION=.*/IOS_VERSION=$VERSION_NUMBER/" ./profile-config/.env
272-
sed -i "s/IOS_BUILD_NUMBER=.*/IOS_BUILD_NUMBER=$NEW_BUILD_NUMBER/" ./profile-config/.env
262+
# Update .env file with CORRECT assignments
263+
sed -i "s/ANDROID_VERSION_CODE=.*/ANDROID_VERSION_CODE=$NEW_VERSION_CODE/" ./profile-config/.env # Integer for build.gradle
264+
sed -i "s/ANDROID_VERSION_NAME=.*/ANDROID_VERSION_NAME=$VERSION_NUMBER/" ./profile-config/.env # String version
265+
sed -i "s/IOS_VERSION=.*/IOS_VERSION=$VERSION_NUMBER/" ./profile-config/.env # String version
266+
sed -i "s/IOS_BUILD_NUMBER=.*/IOS_BUILD_NUMBER=$NEW_BUILD_NUMBER/" ./profile-config/.env # Integer build number
273267
274268
echo "✅ Updated versions:"
275269
echo " Android: $VERSION_NUMBER ($NEW_VERSION_CODE)"

0 commit comments

Comments
 (0)