Build - Ad-hoc release #102
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 - Ad-hoc release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: 'Ref to build APK from (branch, tag, commit)' | |
| required: true | |
| default: 'develop' | |
| build-variant: | |
| description: 'Android build variant' | |
| required: true | |
| default: 'playRelease' | |
| type: choice | |
| options: | |
| - fdroidRelease | |
| - internalDebug | |
| - internalRelease | |
| - playDebug | |
| - playRelease | |
| env: | |
| ASANA_PAT: ${{ secrets.ASANA_ACCESS_TOKEN }} | |
| GOOGLE_APPLICATION_CREDENTIALS: '#{ENV["HOME"]}/jenkins_static/com.duckduckgo.mobile.android/ddg-upload-firebase.json' | |
| GH_TOKEN: ${{ secrets.GT_DAXMOBILE }} | |
| jobs: | |
| build-apk: | |
| name: Generate and upload universal APK to GH Action Run | |
| runs-on: ubuntu-latest | |
| env: | |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GT_DAXMOBILE }} | |
| ref: ${{ github.event.inputs.ref }} | |
| - name: Set up JDK version | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version-file: .github/.java-version | |
| distribution: 'adopt' | |
| - name: Create folder | |
| if: always() | |
| run: mkdir apk | |
| - name: Decode debug keys | |
| if: contains(github.event.inputs.build-variant, 'Debug') | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.DEBUG_PROPERTIES }} | |
| fileName: ddg_android_debug_build.properties | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Decode debug key file | |
| if: contains(github.event.inputs.build-variant, 'Debug') | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.DEBUG_KEY }} | |
| fileName: android | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Decode release keys | |
| if: contains(github.event.inputs.build-variant, 'Release') | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.FAKE_RELEASE_PROPERTIES }} | |
| fileName: ddg_android_build.properties | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Decode release key file | |
| if: contains(github.event.inputs.build-variant, 'Release') | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.FAKE_RELEASE_KEY }} | |
| fileName: android | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| - name: Assemble APK | |
| env: | |
| MALICIOUS_SITE_PROTECTION_AUTH_TOKEN: ${{ secrets.MALICIOUS_SITE_PROTECTION_AUTH_TOKEN }} | |
| run: ./gradlew assemble${{github.event.inputs.build-variant}} -Pforce-default-variant | |
| - name: Move APK to new folder | |
| run: find . -name "*.apk" -exec mv '{}' apk/release${{github.event.inputs.build-variant}}.apk \; | |
| - name: Upload debug apk | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release | |
| path: apk/release${{github.event.inputs.build-variant}}.apk | |
| - name: Cleanup secrets | |
| if: always() | |
| run: rm -rf "$HOME/jenkins_static/com.duckduckgo.mobile.android/"*.properties "$HOME/jenkins_static/com.duckduckgo.mobile.android/android" |