Skip to content

Commit bf51d03

Browse files
committed
Merge branch 'main' into develop
2 parents 26b5364 + 371212a commit bf51d03

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed

.github/scripts/notify_discord_release.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def main():
2424
# Create pub.dev URL
2525
pubdev_url = f"https://pub.dev/packages/{package_name}/versions/{release_version}"
2626

27+
# Create APK download URL
28+
apk_url = f"https://github.com/{repo_name}/releases/download/{release_version}/Stadata_Example_v{release_version}.apk"
29+
2730
# Process release notes (limit length for Discord)
2831
release_notes = ""
2932
if release_body:
@@ -42,6 +45,7 @@ def main():
4245
f"🔗 **Links:**\n"
4346
f"• [GitHub Release]({release_url})\n"
4447
f"• [pub.dev Package]({pubdev_url})\n"
48+
f"• [📱 Example APK]({apk_url})\n"
4549
f"• [Installation Guide](https://pub.dev/packages/{package_name}/install)"
4650
f"{release_notes}\n\n"
4751
f"🛠️ **Quick Install:**\n"
@@ -79,6 +83,11 @@ def main():
7983
"name": "🔗 Quick Install",
8084
"value": f"```yaml\ndependencies:\n {package_name}: ^{release_version}\n```",
8185
"inline": False
86+
},
87+
{
88+
"name": "📱 Example App APK",
89+
"value": f"[📥 Download Stadata_Example_v{release_version}.apk]({apk_url})",
90+
"inline": False
8291
}
8392
],
8493
"footer": {
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Create Release with APK
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Publish to pub.dev"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
create-release:
11+
runs-on: ubuntu-latest
12+
# Only run if the publish workflow succeeded
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Get version from tag
23+
id: get_version
24+
run: |
25+
# Get the latest tag that triggered the publish workflow
26+
TAG=$(git tag --sort=-version:refname | head -1)
27+
VERSION=${TAG#v} # Remove 'v' prefix if present
28+
echo "version=$VERSION" >> $GITHUB_OUTPUT
29+
echo "tag=$TAG" >> $GITHUB_OUTPUT
30+
echo "Found version: $VERSION from tag: $TAG"
31+
32+
- name: Setup Java
33+
uses: actions/setup-java@v4
34+
with:
35+
distribution: 'zulu'
36+
java-version: '17'
37+
38+
- name: Setup Flutter
39+
uses: subosito/flutter-action@v2
40+
with:
41+
channel: 'stable'
42+
43+
- name: Get Flutter dependencies
44+
working-directory: app/example
45+
run: flutter pub get
46+
47+
- name: Build APK
48+
working-directory: app/example
49+
run: |
50+
echo "Building APK for version ${{ steps.get_version.outputs.version }}"
51+
flutter build apk --release
52+
53+
# Rename APK with version
54+
APK_PATH="build/app/outputs/flutter-apk/app-release.apk"
55+
NEW_APK_NAME="Stadata_Example_v${{ steps.get_version.outputs.version }}.apk"
56+
57+
if [ -f "$APK_PATH" ]; then
58+
mv "$APK_PATH" "build/app/outputs/flutter-apk/$NEW_APK_NAME"
59+
echo "apk_path=app/example/build/app/outputs/flutter-apk/$NEW_APK_NAME" >> $GITHUB_OUTPUT
60+
echo "apk_name=$NEW_APK_NAME" >> $GITHUB_OUTPUT
61+
echo "✅ APK built successfully: $NEW_APK_NAME"
62+
else
63+
echo "❌ APK build failed - file not found"
64+
exit 1
65+
fi
66+
id: build_apk
67+
68+
- name: Generate changelog for release
69+
id: generate_changelog
70+
run: |
71+
VERSION="${{ steps.get_version.outputs.version }}"
72+
TAG="${{ steps.get_version.outputs.tag }}"
73+
74+
# Get previous tag for changelog range
75+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -v "^$TAG$" | head -1)
76+
echo "Generating changelog from $PREVIOUS_TAG to $TAG"
77+
78+
# Generate changelog using our script
79+
if [ -n "$PREVIOUS_TAG" ]; then
80+
python .github/scripts/generate_changelog.py \
81+
--version "$VERSION" \
82+
--from-tag "$PREVIOUS_TAG" \
83+
--types "feat,fix,docs,style,refactor,perf,test,chore,ci,build" \
84+
--include-author \
85+
--output RELEASE_CHANGELOG.md
86+
else
87+
echo "## $VERSION" > RELEASE_CHANGELOG.md
88+
echo "" >> RELEASE_CHANGELOG.md
89+
echo "Initial release of STADATA Flutter SDK." >> RELEASE_CHANGELOG.md
90+
fi
91+
92+
# Read changelog content for release body
93+
CHANGELOG_CONTENT=$(cat RELEASE_CHANGELOG.md)
94+
echo "changelog_content<<EOF" >> $GITHUB_OUTPUT
95+
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
96+
echo "EOF" >> $GITHUB_OUTPUT
97+
98+
- name: Create GitHub Release
99+
uses: softprops/action-gh-release@v1
100+
with:
101+
tag_name: ${{ steps.get_version.outputs.tag }}
102+
name: "📦 STADATA Flutter SDK v${{ steps.get_version.outputs.version }}"
103+
body: |
104+
# 🎉 STADATA Flutter SDK v${{ steps.get_version.outputs.version }}
105+
106+
This release has been automatically published to [pub.dev](https://pub.dev/packages/stadata_flutter_sdk/versions/${{ steps.get_version.outputs.version }}).
107+
108+
## 📱 Example App APK
109+
110+
Download the example app APK to try out the SDK features:
111+
- **File**: `${{ steps.build_apk.outputs.apk_name }}`
112+
- **Version**: v${{ steps.get_version.outputs.version }}
113+
- **Platform**: Android
114+
115+
## 🚀 Quick Installation
116+
117+
Add this to your `pubspec.yaml`:
118+
```yaml
119+
dependencies:
120+
stadata_flutter_sdk: ^${{ steps.get_version.outputs.version }}
121+
```
122+
123+
## 📋 Changelog
124+
125+
${{ steps.generate_changelog.outputs.changelog_content }}
126+
127+
## 🔗 Useful Links
128+
129+
- 📦 [pub.dev Package](https://pub.dev/packages/stadata_flutter_sdk)
130+
- 📚 [API Documentation](https://pub.dev/documentation/stadata_flutter_sdk)
131+
- 💻 [GitHub Repository](https://github.com/ryanaidilp/stadata_flutter_sdk)
132+
- 🌐 [Project Documentation](https://stadata-flutter-sdk.vercel.app)
133+
134+
---
135+
136+
🤖 This release was created automatically when the package was published to pub.dev.
137+
files: |
138+
${{ steps.build_apk.outputs.apk_path }}
139+
draft: false
140+
prerelease: false
141+
token: ${{ secrets.GITHUB_TOKEN }}
142+
143+
- name: Upload APK as artifact
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: stadata-example-apk-v${{ steps.get_version.outputs.version }}
147+
path: ${{ steps.build_apk.outputs.apk_path }}
148+
retention-days: 90
149+
150+
- name: Summary
151+
if: always()
152+
run: |
153+
echo "## 📱 Release Creation Summary" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
echo "- **Version**: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
156+
echo "- **Tag**: ${{ steps.get_version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
157+
echo "- **APK**: ${{ steps.build_apk.outputs.apk_name }}" >> $GITHUB_STEP_SUMMARY
158+
echo "- **Release**: [v${{ steps.get_version.outputs.version }}](https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.tag }})" >> $GITHUB_STEP_SUMMARY
159+
echo "" >> $GITHUB_STEP_SUMMARY
160+
161+
if [ "${{ job.status }}" = "success" ]; then
162+
echo "✅ Release created successfully with APK!" >> $GITHUB_STEP_SUMMARY
163+
else
164+
echo "❌ Failed to create release" >> $GITHUB_STEP_SUMMARY
165+
fi

0 commit comments

Comments
 (0)