Skip to content

Commit d0671e5

Browse files
authored
Merge pull request #39 from v2er-app/bugfix/update-pipeline-for-xcconfig
fix: update release pipeline for xcconfig-based version management
2 parents 2096522 + a7e000f commit d0671e5

File tree

3 files changed

+97
-7
lines changed

3 files changed

+97
-7
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'V2er/Info.plist'
9-
- 'V2er.xcodeproj/project.pbxproj'
8+
- 'V2er/Config/Version.xcconfig'
109
workflow_dispatch:
1110
inputs:
1211
force_release:
@@ -38,9 +37,9 @@ jobs:
3837
- name: Check version and create tag if needed
3938
id: check
4039
run: |
41-
# Get current version from project.pbxproj (works on Linux)
42-
CURRENT_VERSION=$(grep -m1 'MARKETING_VERSION = ' V2er.xcodeproj/project.pbxproj | sed 's/.*MARKETING_VERSION = \(.*\);/\1/' | xargs)
43-
CURRENT_BUILD=$(grep -m1 'CURRENT_PROJECT_VERSION = ' V2er.xcodeproj/project.pbxproj | sed 's/.*CURRENT_PROJECT_VERSION = \(.*\);/\1/' | xargs)
40+
# Get current version from Version.xcconfig (works on Linux)
41+
CURRENT_VERSION=$(grep '^MARKETING_VERSION = ' V2er/Config/Version.xcconfig | sed 's/.*MARKETING_VERSION = //' | xargs)
42+
CURRENT_BUILD=$(grep '^CURRENT_PROJECT_VERSION = ' V2er/Config/Version.xcconfig | sed 's/.*CURRENT_PROJECT_VERSION = //' | xargs)
4443
4544
echo "Current version: $CURRENT_VERSION (build $CURRENT_BUILD)"
4645

VERSIONING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,25 @@ This project uses two version identifiers:
2222

2323
### How to Update Versions
2424

25-
To update versions, simply edit the file `V2er/Config/Version.xcconfig`:
25+
#### Option 1: Use the Update Script (Recommended)
26+
```bash
27+
# Interactive mode
28+
./scripts/update-version.sh
29+
30+
# Or with arguments
31+
./scripts/update-version.sh 1.1.3 31
32+
```
33+
34+
#### Option 2: Manual Edit
35+
Edit the file `V2er/Config/Version.xcconfig`:
2636

2737
```bash
2838
# Open the file
2939
V2er/Config/Version.xcconfig
3040

3141
# Update these two lines:
3242
MARKETING_VERSION = 1.1.2 # VERSION_NAME (user-facing version)
33-
CURRENT_PROJECT_VERSION = 29 # VERSION_CODE (build number)
43+
CURRENT_PROJECT_VERSION = 30 # VERSION_CODE (build number)
3444
```
3545

3646
**That's it!** No need to edit project.pbxproj or any other files. The xcconfig file is automatically loaded by Xcode and applies to all build configurations.

scripts/update-version.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
# Script to update app version
4+
# Usage: ./scripts/update-version.sh [version] [build]
5+
# Example: ./scripts/update-version.sh 1.1.3 31
6+
7+
CONFIG_FILE="V2er/Config/Version.xcconfig"
8+
9+
# Colors for output
10+
RED='\033[0;31m'
11+
GREEN='\033[0;32m'
12+
YELLOW='\033[1;33m'
13+
NC='\033[0m' # No Color
14+
15+
# Function to display current version
16+
show_current_version() {
17+
CURRENT_VERSION=$(grep '^MARKETING_VERSION = ' "$CONFIG_FILE" | sed 's/.*MARKETING_VERSION = //' | xargs)
18+
CURRENT_BUILD=$(grep '^CURRENT_PROJECT_VERSION = ' "$CONFIG_FILE" | sed 's/.*CURRENT_PROJECT_VERSION = //' | xargs)
19+
echo -e "${YELLOW}Current version: ${NC}$CURRENT_VERSION (build $CURRENT_BUILD)"
20+
}
21+
22+
# Function to update version
23+
update_version() {
24+
local new_version=$1
25+
local new_build=$2
26+
27+
# Update MARKETING_VERSION
28+
sed -i '' "s/^MARKETING_VERSION = .*/MARKETING_VERSION = $new_version/" "$CONFIG_FILE"
29+
30+
# Update CURRENT_PROJECT_VERSION
31+
sed -i '' "s/^CURRENT_PROJECT_VERSION = .*/CURRENT_PROJECT_VERSION = $new_build/" "$CONFIG_FILE"
32+
33+
echo -e "${GREEN}✅ Version updated successfully!${NC}"
34+
}
35+
36+
# Main script
37+
echo -e "${GREEN}=== V2er Version Update Tool ===${NC}\n"
38+
39+
# Show current version
40+
show_current_version
41+
42+
# If no arguments provided, run in interactive mode
43+
if [ $# -eq 0 ]; then
44+
echo ""
45+
read -p "Enter new version (e.g., 1.1.3): " NEW_VERSION
46+
read -p "Enter new build number (e.g., 31): " NEW_BUILD
47+
48+
if [ -z "$NEW_VERSION" ] || [ -z "$NEW_BUILD" ]; then
49+
echo -e "${RED}❌ Error: Version and build number are required${NC}"
50+
exit 1
51+
fi
52+
else
53+
# Use provided arguments
54+
NEW_VERSION=$1
55+
NEW_BUILD=$2
56+
57+
if [ -z "$NEW_VERSION" ] || [ -z "$NEW_BUILD" ]; then
58+
echo -e "${RED}❌ Error: Usage: $0 <version> <build>${NC}"
59+
echo "Example: $0 1.1.3 31"
60+
exit 1
61+
fi
62+
fi
63+
64+
# Confirm update
65+
echo ""
66+
echo -e "${YELLOW}Will update to:${NC} $NEW_VERSION (build $NEW_BUILD)"
67+
read -p "Proceed? (y/n): " -n 1 -r
68+
echo ""
69+
70+
if [[ $REPLY =~ ^[Yy]$ ]]; then
71+
update_version "$NEW_VERSION" "$NEW_BUILD"
72+
echo ""
73+
show_current_version
74+
echo ""
75+
echo -e "${YELLOW}Next steps:${NC}"
76+
echo "1. Commit the changes: git add -A && git commit -m \"chore: bump version to $NEW_VERSION (build $NEW_BUILD)\""
77+
echo "2. Push to trigger release: git push"
78+
else
79+
echo -e "${RED}❌ Update cancelled${NC}"
80+
exit 1
81+
fi

0 commit comments

Comments
 (0)