forked from jonjomckay/fritter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·129 lines (108 loc) · 3.8 KB
/
release.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env sh
set -e
if [ -z "$1" ]; then
echo "No version name was supplied"
exit 1
fi
if git diff --quiet; then
echo "No unstashed changes, so continuing"
else
echo "You have unstashed or uncommitted changes. Please commit changes before running this!"
exit 1
fi
VERSION_NUMBER=""
generate_version_number() {
delta=$1
VERSION_NUMBER=$(date --date="+$delta days" +%Y%m%d)
if [ -e fastlane/metadata/android/en-US/changelogs/"$VERSION_NUMBER.txt" ]; then
echo "The version $VERSION_NUMBER already exists, so incrementing it"
generate_version_number $((delta + 1))
fi
}
generate_version_number 0
VERSION_NAME=$1
VERSION_FLUTTER="3.3.2"
FULL_VERSION="$VERSION_NAME"+"$VERSION_NUMBER"
# Set the new version in pubspec.yaml
sed -i "s/version: .*/version: $FULL_VERSION/g" pubspec.yaml
# Rename the draft changelog with the new version number
if [ -e fastlane/metadata/android/en-US/changelogs/next.txt ]; then
mv fastlane/metadata/android/en-US/changelogs/next.txt fastlane/metadata/android/en-US/changelogs/"$VERSION_NUMBER".txt
fi
# Create a new draft changelog for the next release
touch fastlane/metadata/android/en-US/changelogs/next.txt
# Commit the changes
git add pubspec.yaml fastlane/metadata/android/en-US/changelogs/next.txt fastlane/metadata/android/en-US/changelogs/"$VERSION_NUMBER".txt
git commit -m "Tagging v$VERSION_NAME"
git tag v"$VERSION_NAME"
git push
git push --tags
VERSION_COMMIT=$(git rev-parse HEAD)
echo "F-Droid metadata:"
echo ""
FDROID_METADATA=$(cat << EOF
- versionName: $VERSION_NAME
versionCode: ${VERSION_NUMBER}0
commit: $VERSION_COMMIT
sudo:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
output: build/app/outputs/flutter-apk/app-x86_64-release.apk
srclibs:
- flutter@$VERSION_FLUTTER
rm:
- ios
- test
build:
- \$\$flutter\$\$/bin/flutter config --no-analytics
- \$\$flutter\$\$/bin/flutter packages pub get
- \$\$flutter\$\$/bin/flutter packages pub run flutter_oss_licenses:generate.dart
- \$\$flutter\$\$/bin/flutter packages pub run intl_utils:generate
- \$\$flutter\$\$/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi
--target-platform=android-x64
- versionName: $VERSION_NAME
versionCode: ${VERSION_NUMBER}1
commit: $VERSION_COMMIT
sudo:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
output: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
srclibs:
- flutter@$VERSION_FLUTTER
rm:
- ios
- test
build:
- \$\$flutter\$\$/bin/flutter config --no-analytics
- \$\$flutter\$\$/bin/flutter packages pub get
- \$\$flutter\$\$/bin/flutter packages pub run flutter_oss_licenses:generate.dart
- \$\$flutter\$\$/bin/flutter packages pub run intl_utils:generate
- \$\$flutter\$\$/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi
--target-platform=android-arm
- versionName: $VERSION_NAME
versionCode: ${VERSION_NUMBER}2
commit: $VERSION_COMMIT
sudo:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
output: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
srclibs:
- flutter@$VERSION_FLUTTER
rm:
- ios
- test
build:
- \$\$flutter\$\$/bin/flutter config --no-analytics
- \$\$flutter\$\$/bin/flutter packages pub get
- \$\$flutter\$\$/bin/flutter packages pub run flutter_oss_licenses:generate.dart
- \$\$flutter\$\$/bin/flutter packages pub run intl_utils:generate
- \$\$flutter\$\$/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi
--target-platform=android-arm64
EOF
)
echo "$FDROID_METADATA"
# Build the Play Store version
./build-play.sh