2424 - name : Checkout repository
2525 uses : actions/checkout@v4
2626
27+ - name : Show disk usage before cleanup
28+ run : df -h /
29+
30+ - name : Free disk space on runner
31+ uses : jlumbroso/free-disk-space@main
32+ with :
33+ tool-cache : true
34+ android : false
35+ dotnet : true
36+ haskell : true
37+ large-packages : true
38+ docker-images : true
39+ swap-storage : true
40+
41+ - name : Show disk usage after cleanup
42+ run : df -h /
43+
2744 - name : Setup Java
2845 uses : actions/setup-java@v4
2946 with :
3754 uses : subosito/flutter-action@v2
3855 with :
3956 flutter-version : ${{ env.FLUTTER_VERSION }}
57+ channel : stable
58+
59+ - name : Clean Flutter project
60+ run : |
61+ flutter clean
62+ rm -rf build
63+ cd android && ./gradlew clean && cd -
64+ rm -rf ~/.gradle/caches
65+ rm -rf ~/.gradle/daemon
66+ rm -rf ~/.android/build-cache
67+
68+ - name : Show disk usage after cleanup
69+ run : df -h /
4070
4171 - name : Decode Android keystore
4272 run : echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > ${{ env.KEYSTORE_PATH }}
@@ -77,17 +107,50 @@ jobs:
77107 needs : build_android
78108 permissions :
79109 contents : write
110+ env :
111+ APK_RELEASE_PATH : apk-release/*.apk
80112 steps :
113+ - name : Checkout repository
114+ uses : actions/checkout@v4
115+
116+ - name : Parse Build Tag & Release Notes from CHANGELOG.md
117+ id : parse_changelog
118+ run : |
119+ echo "Parsing CHANGELOG.md"
120+
121+ awk '
122+ BEGIN {found=0}
123+ /^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/ && found==0 {
124+ line=$0
125+ gsub(/^##[[:space:]]*/, "", line)
126+ sub(/[[:space:]]+-[[:space:]]*.*$/, "", line)
127+ gsub(/^\[|\]$/, "", line)
128+ tag=line
129+ if (tag !~ /^v/) tag = "v" tag
130+ found=1
131+ next
132+ }
133+ found==1 {
134+ if (/^##[[:space:]]+/) exit
135+ notes = notes $0 "\n"
136+ }
137+ END {
138+ printf("build_tag=%s\n", tag)
139+ printf("release_notes<<EOF\n%s\nEOF\n", notes)
140+ }
141+ ' CHANGELOG.md >> $GITHUB_OUTPUT
142+
81143 - name : Download APK artifact
82144 uses : actions/download-artifact@v4
83145 with :
84146 name : apk-release
147+ path : apk-release
85148
86149 - name : Deploy to GitHub Release
87150 uses : ncipollo/release-action@v1.14.0
88151 with :
89152 allowUpdates : true
90- artifacts : ${{ env.APK_PATH }}
153+ artifacts : ${{ env.APK_RELEASE_PATH }}
91154 artifactContentType : apk
92- generateReleaseNotes : true
93- tag : latest_build
155+ tag : ${{ steps.parse_changelog.outputs.build_tag }}
156+ body : ${{ steps.parse_changelog.outputs.release_notes }}
0 commit comments