Build and Release Qama #18
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: Build and Release | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| beta: | |
| type: boolean | |
| description: "Is this a beta release?" | |
| default: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: 'temurin' | |
| java-version: '17' | |
| - name: Extract Version | |
| id: extract_version | |
| run: | | |
| # שליפת גרסה מקובץ pubspec.yaml | |
| VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "beta=${{ github.event.inputs.beta }}" >> $GITHUB_OUTPUT | |
| - name: Decode Keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > $GITHUB_WORKSPACE/upload-keystore.jks | |
| - name: Create key.properties | |
| run: | | |
| echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > key.properties | |
| echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> key.properties | |
| echo "keyAlias=upload" >> key.properties | |
| echo "storeFile=$GITHUB_WORKSPACE/upload-keystore.jks" >> key.properties | |
| - name: Build APKs | |
| run: | | |
| flutter pub get | |
| # בניית גרסת Normal | |
| flutter build apk --flavor normal --release --obfuscate --split-debug-info=build/debug-info | |
| flutter build apk --flavor fdroid -t lib/main_fdroid.dart --release --obfuscate --split-debug-info=build/debug-info | |
| - name: Save APKs as Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-apks | |
| path: build/app/outputs/flutter-apk/*.apk | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ steps.extract_version.outputs.tag }} | |
| name: "Release ${{ steps.extract_version.outputs.version }}${{ github.event.inputs.beta == 'true' && ' (Beta)' || '' }}" | |
| prerelease: ${{ github.event.inputs.beta == true }} | |
| draft: true | |
| files: build/app/outputs/flutter-apk/*.apk | |
| generate_release_notes: true |