-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_release.sh
More file actions
executable file
·58 lines (46 loc) · 1.55 KB
/
create_release.sh
File metadata and controls
executable file
·58 lines (46 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# script to make git releases
# Check if gh CLI is installed
if ! command -v gh &> /dev/null; then
echo "Error: GitHub CLI (gh) is not installed"
exit 1
fi
# Check if we're on main branch
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "Error: Not on main branch"
exit 1
fi
# Check if repo is clean
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Repository has uncommitted changes"
exit 1
fi
# Get current version from pubspec.yaml
CURRENT_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //')
echo "Current version: $CURRENT_VERSION"
# Split version into parts
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "New version will be: $NEW_VERSION"
# Update version in pubspec.yaml
sed -i "s/version: .*/version: $NEW_VERSION/" pubspec.yaml
# Build APK
echo "Building APK..."
flutter build apk --release
# Create git tag and commit
git add pubspec.yaml
git commit -m "Release version $NEW_VERSION"
git tag -a "v$NEW_VERSION" -m "Release version $NEW_VERSION"
# Push changes and tags
echo "Pushing changes to remote..."
git push origin main
git push origin "v$NEW_VERSION"
# Create GitHub release with APK
echo "Creating GitHub release..."
gh release create "v$NEW_VERSION" \
--title "Release v$NEW_VERSION" \
--notes "Release version $NEW_VERSION" \
build/app/outputs/flutter-apk/app-release.apk#"structwafels-toolbox-$NEW_VERSION.apk"
echo "Release $NEW_VERSION created and pushed successfully!"