Dart #334
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Dart | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build_android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| submodules: recursive | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: pubspec.yaml | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: "3.6.0" | |
| - name: setup credentials | |
| run: | | |
| git config --global url.https://${{ secrets.PAT_ORG }}@github.com/namidaco/.insteadOf https://github.com/namidaco/ | |
| git config --global url.https://${{ secrets.PAT }}@github.com/MSOB7YY/.insteadOf https://github.com/MSOB7YY/ | |
| - name: Setup dependencies | |
| run: | | |
| flutter clean | |
| flutter pub get | |
| flutter pub upgrade | |
| - name: Extract version from pubspec.yaml | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -o 'version:.*' pubspec.yaml | awk '{print $2}') | |
| echo ::set-output name=version::"$VERSION" | |
| - uses: actions/setup-java@v1 | |
| with: | |
| java-version: "21" | |
| - name: Create keystore & key.properties | |
| run: | | |
| echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks | |
| echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties | |
| - name: Creating original apks | |
| continue-on-error: true | |
| run: | | |
| mkdir -p build_final | |
| flutter build apk --target-platform android-arm64 --release | |
| mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version }}-arm64-v8a.apk | |
| flutter build apk --target-platform android-arm --release | |
| mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version }}-armeabi-v7a.apk | |
| - name: Creating clone repo & apks | |
| continue-on-error: true | |
| run: | | |
| git clone https://github.com/namidaco/namida/ namida-clone | |
| cd namida-clone | |
| flutter clean | |
| flutter pub get | |
| flutter pub upgrade | |
| git submodule update --init --remote --recursive | |
| find ./ -type f -exec sed -i -e 's/com.msob7y.namida/com.msob7y.namida.snapshot/g' {} \; | |
| echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks | |
| echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties | |
| mkdir -p ../build_final | |
| flutter build apk --target-platform android-arm64 --release | |
| mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version }}-clone-arm64-v8a.apk | |
| flutter build apk --target-platform android-arm --release | |
| mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version }}-clone-armeabi-v7a.apk | |
| cd ../ | |
| - name: Get the previous release date | |
| continue-on-error: true | |
| run: | | |
| release_info=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/namidaco/namida-snapshots/releases/latest) | |
| release_date=$(echo "$release_info" | jq -r '.published_at') | |
| echo "PREVIOUS_RELEASE_DATE=$release_date" >> $GITHUB_ENV | |
| - name: Generate Changelog | |
| continue-on-error: true | |
| run: | | |
| bash gen_beta_changelog.sh | |
| cat ./beta_changelog.md | |
| - name: Creating Snapshot Release at namida-snapshots | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| repository: namidaco/namida-snapshots | |
| make_latest: true | |
| draft: false | |
| tag_name: ${{ steps.extract_version.outputs.version}} | |
| body_path: ./beta_changelog.md | |
| files: | | |
| build_final/* | |
| token: ${{ secrets.SNAPSHOTS_REPO_SECRET }} | |
| - name: Upload all APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-apks | |
| path: build_final/** |