diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml new file mode 100644 index 00000000..bba2dec9 --- /dev/null +++ b/.github/workflows/latest.yml @@ -0,0 +1,148 @@ +# This is workflow to build Android app for testing + +name: The latest Android build from main-branch + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +# Build job needs test ! +jobs: + + # Run React Native Eslint and Jest tests + test: + if: ${{ false }} + name: Test + # Setup Ubuntu version + runs-on: ubuntu-latest + strategy: + # Node version matrix + matrix: + node-version: [20.11.1] + # Steps + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + # Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + # Install dependencies + - name: Install dependencies + run: yarn install + # Get defaultConfig + - name: Get defaultConfig + env: + defaultConfig: ${{ secrets.DEFAULTCONFIG }} + shell: bash + run: | + touch defaultConfig.ts + echo "$defaultConfig" >> defaultConfig.ts + + # Run lint -tests + - name: Run Eslint tests + if: ${{ false }} + run: yarn lint --fix + # Run Jest -tests + - name: Run Jest tests + if: ${{ false }} + run: yarn test + +# Decode, Build and sign Android application + build: + # needs: test + name: Android-build + # Set Ubuntu version + runs-on: ubuntu-latest + # Node version matrix + strategy: + matrix: + node-version: [20.11.1] + # Steps + steps: + - name: Checkout to git repository + uses: actions/checkout@v4 + # Setup Node + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - name: Install dependencies + run: | + yarn install + + # Get defaultConfig + - name: Get defaultConfig + env: + defaultConfig: ${{ secrets.DEFAULTCONFIG }} + shell: bash + run: | + touch defaultConfig.ts + echo "$defaultConfig" >> defaultConfig.ts + + # Set up Java 17 + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' # You can use 'adopt', 'zulu', or another distribution if needed + + # Install Ruby + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3.0' + + # Update bundler + - name: Update bundler + run: bundle update --bundler + working-directory: android + + # Bundle install + - name: Bundle install + run: gem install bundler && bundle install + working-directory: android + + # Decode upload keystore + - name: Decode Keystore File + uses: timheuer/base64-to-file@v1 + id: android_keystore + with: + fileName: "android_keystore.keystore" + encodedString: ${{ secrets.KEYSTORE }} + + # Build and sign + - name: Build + env: + KEYSTORE: ${{ steps.android_keystore.outputs.filePath }} + SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} + SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} + SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} + # SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }} + run: | + echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" > .env + chmod +x ./gradlew + bundle exec fastlane android build_apk + working-directory: android + + - name: Rename APK + run: + mv "./app/build/outputs/apk/release/app-release.apk" "./app/build/outputs/apk/release/latest.apk" + working-directory: android + + # Upload artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: latest.apk + path: | + ${{ github.workspace }}/android/app/build/outputs/apk/release/latest.apk + retention-days: 7 + overwrite: true diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 28549ed4..0944c8da 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -56,6 +56,20 @@ platform :android do push_to_git_remote if should_push end end + + # Build APK only + desc "Android build APK" + lane :build_apk do + # Gradle clean + gradle(task: 'clean', project_dir: './') + # Gradle sign aab -file + gradle(task: 'assemble', build_type: "Release", project_dir: './',properties: { + "android.injected.signing.store.file" => ENV["KEYSTORE"], + "android.injected.signing.store.password" => ENV["SIGNING_STORE_PASSWORD"], + "android.injected.signing.key.alias" => ENV["SIGNING_KEY_ALIAS"], + "android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"] + }) + end # Sign, build and deploy to Google Play Store desc "Sign, build, and deploy to Google Play Store" @@ -91,7 +105,7 @@ platform :android do "android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"] }) end - + # Deploy to Google Play Store desc "Deploy a new version to the Google Play" lane :deploy do diff --git a/android/fastlane/README.md b/android/fastlane/README.md index 1091d2a1..cd8daf13 100644 --- a/android/fastlane/README.md +++ b/android/fastlane/README.md @@ -1,29 +1,72 @@ fastlane documentation -================ +---- + # Installation Make sure you have the latest version of the Xcode command line tools installed: -``` +```sh xcode-select --install ``` -Install _fastlane_ using -``` -[sudo] gem install fastlane -NV -``` -or alternatively using `brew install fastlane` +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) # Available Actions + ## Android -### android increment_version -``` -fastlane android increment_version + +### android increment_android_version + +```sh +[bundle exec] fastlane android increment_android_version ``` + Increment build and version number and push to repository - Build number = version code, version number = version name +### android build_apk + +```sh +[bundle exec] fastlane android build_apk +``` + +Android build APK + +### android build_sign_and_deploy + +```sh +[bundle exec] fastlane android build_sign_and_deploy +``` + +Sign, build, and deploy to Google Play Store + +### android get_version_code_and_version_name + +```sh +[bundle exec] fastlane android get_version_code_and_version_name +``` + +Get version code and version name + +### android build_and_sign + +```sh +[bundle exec] fastlane android build_and_sign +``` + +Release for the Android beta + +### android deploy + +```sh +[bundle exec] fastlane android deploy +``` + +Deploy a new version to the Google Play + ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. -More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). -The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).