π feat: Install shared_preferences package
#13
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: Flutter Build Android APK | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.29.2' | |
| channel: 'stable' | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Run tests | |
| run: flutter test | |
| - name: Build APK | |
| run: flutter build apk --release | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-apk | |
| path: build/app/outputs/flutter-apk/app-release.apk | |
| # New steps for creating tag and release | |
| - name: Generate build timestamp | |
| id: timestamp | |
| run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Create tag | |
| id: create_tag | |
| if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| run: | | |
| TAG_NAME="v$(grep 'version:' pubspec.yaml | awk '{print $2}' | tr -d "'")-build-${{ steps.timestamp.outputs.timestamp }}" | |
| git tag $TAG_NAME | |
| git push origin $TAG_NAME | |
| echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ steps.create_tag.outputs.tag }} | |
| name: Release ${{ steps.create_tag.outputs.tag }} | |
| artifacts: "build/app/outputs/flutter-apk/app-release.apk" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| generateReleaseNotes: true | |