feat: generate local.properties from example in CI #46
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: Android CI | |
| on: | |
| push: | |
| branches: | |
| - development | |
| - master | |
| - internal-testing/** | |
| workflow_dispatch: | |
| env: | |
| KEYSTORE_FILE: keystore-qrbarcode.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| GOOGLE_PLAY_JSON_PATH: app/qrbarcode-8b0b8-aaefa03b2374.json | |
| jobs: | |
| setup: | |
| name: Setup Environment | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - name: Cache Ruby Gems | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - name: Install Dependencies | |
| run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - name: Generate local.properties from example | |
| run: | | |
| chmod +x ./scripts/before-ci.sh | |
| ./scripts/before-ci.sh | |
| - name: Decode Keystore File | |
| run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > "app/${{ env.KEYSTORE_FILE }}" | |
| - name: Write local.properties | |
| run: | | |
| echo "sdk.dir=$ANDROID_HOME" > local.properties | |
| echo "KEYSTORE_FILE=${{ env.KEYSTORE_FILE }}" >> local.properties | |
| echo "KEYSTORE_PASSWORD=${{ env.KEYSTORE_PASSWORD }}" >> local.properties | |
| echo "KEY_ALIAS=${{ env.KEY_ALIAS }}" >> local.properties | |
| echo "KEY_PASSWORD=${{ env.KEY_PASSWORD }}" >> local.properties | |
| - name: Create Google Service Account JSON | |
| run: | | |
| mkdir -p app | |
| echo "${{ secrets.GOOGLE_PLAY_JSON }}" | base64 --decode > ${{ env.GOOGLE_PLAY_JSON_PATH }} | |
| build: | |
| name: Build AAB | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| - uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - run: bundle exec fastlane buildBundle | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-aab | |
| path: app/build/outputs/bundle/release/*.aab | |
| unit-test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - run: bundle exec fastlane test | |
| code-analysis: | |
| name: Lint & Check | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - run: ./gradlew clean check | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: lint-reports | |
| path: | | |
| app/build/reports/**/*.html | |
| app/build/intermediates/lint_intermediate_text_report/debug/*.txt | |
| app/build/reports/lint-baseline.xml | |
| deploy-release: | |
| name: Deploy to Play Store (Production) | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - run: bundle exec fastlane deployRelease | |
| deploy-beta: | |
| name: Deploy to Play Store (Beta) | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/development' | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - run: bundle exec fastlane deployBeta | |
| deploy-firebase-internal: | |
| name: Distribute via Firebase (Internal) | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/heads/internal-testing/') | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| - run: | | |
| bundle config set path 'vendor/bundle' | |
| bundle install | |
| - run: bundle exec fastlane deployFirebase --verbose |