|
64 | 64 | credentialJson: ${{ secrets.CREDENTIAL_JSON }} |
65 | 65 | flutter: true |
66 | 66 | skipTests: true |
67 | | - distribution: "zulu" |
68 | | - java-version: "17" |
69 | | - |
70 | | - - name: 📦 Get dependencies |
71 | | - run: flutter pub get |
72 | | - |
73 | | - - name: 📦 Get example dependencies |
74 | | - working-directory: example |
75 | | - run: flutter pub get |
76 | | - |
77 | | - - name: 🏗️ Build example APK |
78 | | - working-directory: example |
79 | | - run: flutter build apk --release |
80 | | - |
81 | | - - name: 📤 Upload APK to release |
82 | | - uses: actions/upload-release-asset@v1 |
83 | | - env: |
84 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
85 | | - with: |
86 | | - upload_url: ${{ needs.create_release.outputs.upload_url }} |
87 | | - asset_path: example/build/app/outputs/flutter-apk/app-release.apk |
88 | | - asset_name: weight_scale_example_${{ needs.create_release.outputs.tag_name }}.apk |
89 | | - asset_content_type: application/vnd.android.package-archive |
90 | | - |
91 | | - # 📦 Publish to pub.dev |
92 | | - publish: |
93 | | - name: 📦 Publish to pub.dev |
94 | | - runs-on: ubuntu-latest |
95 | | - needs: [create_release, build_assets] |
96 | | - environment: production |
97 | | - |
98 | | - steps: |
99 | | - - name: 📚 Checkout repository |
100 | | - uses: actions/checkout@v4 |
101 | | - |
102 | | - - name: 🐦 Setup Flutter |
103 | | - uses: subosito/flutter-action@v2 |
104 | | - with: |
105 | | - flutter-version: ${{ env.FLUTTER_VERSION }} |
106 | | - channel: "stable" |
107 | | - cache: true |
108 | | - |
109 | | - - name: 📦 Get dependencies |
110 | | - run: flutter pub get |
111 | | - |
112 | | - - name: 🧪 Run tests before publish |
113 | | - run: flutter test |
114 | | - |
115 | | - - name: 📋 Validate package |
116 | | - run: dart pub publish --dry-run |
117 | | - |
118 | | - - name: 🚀 Publish to pub.dev |
119 | | - env: |
120 | | - PUB_TOKEN: ${{ secrets.PUB_CREDENTIALS }} |
121 | | - run: | |
122 | | - if [ -n "$PUB_TOKEN" ]; then |
123 | | - echo "$PUB_TOKEN" > ~/.pub-cache/credentials.json |
124 | | - dart pub publish --force |
125 | | - else |
126 | | - echo "PUB_CREDENTIALS not set, skipping publish" |
127 | | - fi |
128 | | -
|
129 | | - # 📢 Post-Release Actions |
130 | | - post_release: |
131 | | - name: 📢 Post-Release Actions |
132 | | - runs-on: ubuntu-latest |
133 | | - needs: [create_release, publish] |
134 | | - if: success() |
135 | | - |
136 | | - steps: |
137 | | - - name: 📚 Checkout repository |
138 | | - uses: actions/checkout@v4 |
139 | | - |
140 | | - - name: 📊 Update badges |
141 | | - run: | |
142 | | - echo "🎉 Release ${{ needs.create_release.outputs.tag_name }} published successfully!" |
143 | | - echo "📦 Available on pub.dev: https://pub.dev/packages/weight_scale" |
144 | | - echo "📱 Example APK available in GitHub Releases" |
145 | | -
|
146 | | - - name: 🐦 Tweet about release (optional) |
147 | | - if: false # Enable when you have Twitter integration |
148 | | - run: | |
149 | | - echo "Would tweet: 🎉 Weight Scale Plugin ${{ needs.create_release.outputs.tag_name }} is now available!" |
0 commit comments