Android 1.0.5 #42
Workflow file for this run
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 Release Build | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "17" | |
| distribution: "adopt" | |
| - name: Setup Gradle build action | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Install Bundletool | |
| run: | | |
| wget https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar -O /usr/local/bin/bundletool.jar | |
| - name: Decode Keystore | |
| env: | |
| ENCODED_KEYSTORE: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }} | |
| run: | | |
| echo $ENCODED_KEYSTORE > keystore_base64.txt | |
| base64 -d keystore_base64.txt > ${{ runner.temp }}/keystore.jks | |
| - name: Build AAB | |
| env: | |
| DECODED_KEYSTORE_PATH: ${{ runner.temp }}/keystore.jks | |
| RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} | |
| RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} | |
| EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} | |
| REAPER_API_KEY: ${{ secrets.REAPER_API_KEY }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} | |
| run: ./gradlew :app:bundlePlayStoreRelease | |
| - name: Convert AAB to APK | |
| run: | | |
| java -jar /usr/local/bin/bundletool.jar build-apks \ | |
| --mode=universal \ | |
| --bundle=./app/build/outputs/bundle/playStoreRelease/app-playStoreRelease.aab \ | |
| --output=${{ runner.temp }}/app-release.apks \ | |
| --ks=${{ runner.temp }}/keystore.jks \ | |
| --ks-pass=pass:${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} \ | |
| --ks-key-alias=${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} \ | |
| --key-pass=pass:${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| unzip ${{ runner.temp }}/app-release.apks -d ${{ runner.temp }}/apks | |
| - name: Upload .apk | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| path: ${{ runner.temp }}/apks/universal.apk | |
| name: hackernews-universal-${{github.sha}}.apk | |
| if-no-files-found: error | |
| - name: Add APK to GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| fail_on_unmatched_files: true | |
| # see https://github.com/softprops/action-gh-release/issues/158 | |
| files: | | |
| ${{ runner.temp }}/apks/universal.apk | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-west-1 | |
| - name: Extract version from tag | |
| run: echo "VERSION_NAME=$(echo ${{ github.event.release.tag_name }} | sed 's/android-//')" >> $GITHUB_ENV | |
| - name: Upload AAB to S3 | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| run: | | |
| aws s3 cp app/build/outputs/bundle/playStoreRelease/app-playStoreRelease.aab s3://hn-artifacts/app-release-${{ env.VERSION_NAME }}.aab |