Merge pull request #8 from palakkeni5/feature/version-update #45
This file contains 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 Build | |
on: | |
push: | |
branches: ['prod'] | |
env: | |
PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
permissions: | |
contents: write | |
jobs: | |
android-build: | |
name: Android Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Show self-hosted machine infomation | |
run: uname -a | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.12.2 | |
- name: Install dependencies | |
run: npm install | |
- name: Install react native | |
run: npm i -g react-native-cli | |
- name: Set up Java | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Decode Keystore | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
TMP_KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore | |
mkdir "${TMP_KEYSTORE_FILE_PATH}" | |
echo $ENCODED_STRING | base64 -di > "${TMP_KEYSTORE_FILE_PATH}"/palak_keystore.jks | |
- name: Setup build tool version variable | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
- name: Make Gradlew Executable | |
run: cd android && chmod +x ./gradlew && ./gradlew clean | |
- name: Create React Native bundle for android production | |
run: react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ | |
- name: Build Android Release | |
run: | | |
cd android && ./gradlew app:assembleRelease | |
env: | |
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }} | |
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }} | |
- name: Upload APK | |
id: uploadArtifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app | |
path: ${{ github.workspace}}/android/app/build/outputs/apk/release | |
- name: Generate release tag | |
shell: bash | |
run: echo "branch=${BRANCH_NAME}_$(date +"%Y.%m.%d_%H-%M")" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: create new release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.extract_branch.outputs.branch }} | |
files: | | |
${{ github.workspace}}/android/app/build/outputs/apk/release/app-release.apk |