Skip to content

Commit 48a0b00

Browse files
committed
refine CI
1 parent 1430c23 commit 48a0b00

2 files changed

Lines changed: 31 additions & 17 deletions

File tree

.github/workflows/production-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ jobs:
118118
echo "Extracted version from pubspec.yaml: $VERSION"
119119
fi
120120
121-
# Validate version format (X.Y.Z)
122-
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
121+
# Validate version format (X.Y.Z or X.Y.Z+build)
122+
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(\+[0-9]+)?$ ]]; then
123123
echo "✅ Valid version format: $VERSION"
124124
echo "version=$VERSION" >> $GITHUB_OUTPUT
125125
else
126126
echo "❌ Invalid version format: $VERSION"
127-
echo "Expected format: X.Y.Z (e.g., 6.17.6)"
127+
echo "Expected format: X.Y.Z or X.Y.Z+build (e.g., 6.17.6 or 6.17.4+1)"
128128
exit 1
129129
fi
130130
@@ -205,7 +205,7 @@ jobs:
205205
- name: 🔍 Validate package
206206
run: |
207207
echo "Running pub publish dry-run to validate package..."
208-
flutter pub publish --dry-run --force
208+
flutter pub publish --dry-run
209209
210210
- name: 📝 Check pub.dev credentials
211211
run: |

.github/workflows/rc-release.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
# 4. Creates a pre-release tag on GitHub
1313
# 5. Optionally notifies team via Slack (placeholder for future)
1414
#
15-
# Branch Convention: releases/X.x.x/X.Y.x/X.Y.Z-rcN
16-
# Example: releases/6.x.x/6.18.x/6.18.0-rc1
17-
# Where: X, Y, Z are version numbers, and lowercase 'x' is literal
15+
# Branch Convention: releases/X.x.x/X.Y.x/X.Y.Z[-rcN][+build]
16+
# Examples:
17+
# - releases/6.x.x/6.18.x/6.18.0-rc1
18+
# - releases/6.x.x/6.17.x/6.17.4+1-rc1
19+
# - releases/6.x.x/6.17.x/6.17.4+1
20+
# Where: X, Y, Z are version numbers, lowercase 'x' is literal,
21+
# -rcN is optional for release candidates, +build is optional build number
1822
#
1923
# Triggers:
2024
# - Push to branches matching releases/** pattern
@@ -76,14 +80,17 @@ jobs:
7680
VERSION="${{ github.event.inputs.version }}"
7781
echo "Using manual version: $VERSION"
7882
else
79-
# Extract version from branch name: releases/X.x.x/X.Y.x/X.Y.Z-rcN
80-
# Example: releases/6.x.x/6.18.x/6.18.0-rc1
83+
# Extract version from branch name: releases/X.x.x/X.Y.x/X.Y.Z[-rcN][+build]
84+
# Examples:
85+
# - releases/6.x.x/6.18.x/6.18.0-rc1
86+
# - releases/6.x.x/6.17.x/6.17.4+1-rc1
87+
# - releases/6.x.x/6.17.x/6.17.4+1
8188
BRANCH_NAME="${{ github.ref_name }}"
8289
echo "Branch name: $BRANCH_NAME"
8390
84-
# Extract version using regex
85-
# Pattern: releases/X.x.x/X.Y.x/X.Y.Z-rcN where x is literal 'x'
86-
if [[ $BRANCH_NAME =~ releases/([0-9]+)\.x\.x/([0-9]+\.[0-9]+)\.x/([0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+)$ ]]; then
91+
# Extract version using regex - now supports +build suffix
92+
# Pattern: releases/X.x.x/X.Y.x/X.Y.Z[+build][-rcN] where x is literal 'x'
93+
if [[ $BRANCH_NAME =~ releases/([0-9]+)\.x\.x/([0-9]+\.[0-9]+)\.x/([0-9]+\.[0-9]+\.[0-9]+(\+[0-9]+)?(-rc[0-9]+)?)$ ]]; then
8794
VERSION="${BASH_REMATCH[3]}"
8895
MAJOR="${BASH_REMATCH[1]}"
8996
MAJOR_MINOR="${BASH_REMATCH[2]}"
@@ -92,7 +99,7 @@ jobs:
9299
echo "Major version: $MAJOR"
93100
echo "Major.Minor: $MAJOR_MINOR"
94101
95-
# Validate that version starts with the correct major.minor
102+
# Validate that version starts with the correct major.minor (before any +build suffix)
96103
VERSION_PREFIX=$(echo "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')
97104
if [[ "$VERSION_PREFIX" != "$MAJOR_MINOR" ]]; then
98105
echo "❌ Version mismatch!"
@@ -111,15 +118,18 @@ jobs:
111118
fi
112119
else
113120
echo "❌ Invalid branch name format!"
114-
echo "Expected: releases/X.x.x/X.Y.x/X.Y.Z-rcN"
115-
echo "Example: releases/6.x.x/6.18.x/6.18.0-rc1"
121+
echo "Expected: releases/X.x.x/X.Y.x/X.Y.Z[-rcN][+build]"
122+
echo "Examples:"
123+
echo " - releases/6.x.x/6.18.x/6.18.0-rc1"
124+
echo " - releases/6.x.x/6.17.x/6.17.4+1-rc1"
125+
echo " - releases/6.x.x/6.17.x/6.17.4+1"
116126
echo "Got: $BRANCH_NAME"
117127
exit 1
118128
fi
119129
fi
120130
121-
# Validate version format
122-
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$ ]]; then
131+
# Validate version format (supports +build suffix)
132+
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(\+[0-9]+)?(-rc[0-9]+)?$ ]]; then
123133
echo "✅ Valid version format: $VERSION"
124134
echo "version=$VERSION" >> $GITHUB_OUTPUT
125135
echo "is_valid=true" >> $GITHUB_OUTPUT
@@ -181,8 +191,10 @@ jobs:
181191
VERSION="${{ needs.validate-release.outputs.version }}"
182192
183193
# Remove -rcN suffix for pubspec.yaml (pub.dev doesn't support pre-release tags)
194+
# But preserve +build suffix if present (pub.dev supports build numbers)
184195
PUBSPEC_VERSION=$(echo $VERSION | sed 's/-rc[0-9]*$//')
185196
197+
echo "Full version: $VERSION"
186198
echo "Updating pubspec.yaml to version: $PUBSPEC_VERSION"
187199
188200
# Update version in pubspec.yaml
@@ -232,11 +244,13 @@ jobs:
232244
- name: 📝 Update podspec version
233245
run: |
234246
VERSION="${{ needs.validate-release.outputs.version }}"
247+
# Remove -rcN suffix but preserve +build for podspec
235248
PODSPEC_VERSION=$(echo $VERSION | sed 's/-rc[0-9]*$//')
236249
237250
PODSPEC_FILE="ios/appsflyer_sdk.podspec"
238251
239252
if [ -f "$PODSPEC_FILE" ]; then
253+
echo "Full version: $VERSION"
240254
echo "Updating podspec to version: $PODSPEC_VERSION"
241255
sed -i.bak "s/s\.version.*=.*/s.version = '$PODSPEC_VERSION'/" "$PODSPEC_FILE"
242256
rm "${PODSPEC_FILE}.bak"

0 commit comments

Comments
 (0)