Merge pull request #138 from DenisovAV/feature/builder-validation-tdd #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Build | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Triggers on tags like v0.11.7, v1.0.0, etc. | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required for creating releases | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Get version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Install plugin dependencies | |
| run: flutter pub get | |
| - name: Install example dependencies | |
| working-directory: example | |
| run: flutter pub get | |
| - name: Build example APK (release) | |
| working-directory: example | |
| run: flutter build apk --release | |
| - name: Rename APK with version | |
| run: | | |
| mv example/build/app/outputs/flutter-apk/app-release.apk \ | |
| example/build/app/outputs/flutter-apk/flutter-gemma-example-v${{ steps.version.outputs.VERSION }}.apk | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| example/build/app/outputs/flutter-apk/flutter-gemma-example-v${{ steps.version.outputs.VERSION }}.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flutter-gemma-example-v${{ steps.version.outputs.VERSION }} | |
| path: example/build/app/outputs/flutter-apk/flutter-gemma-example-v${{ steps.version.outputs.VERSION }}.apk | |
| retention-days: 90 |