loading...

React Native πŸš€ Github Actions

realabbas profile image Ali Abbas ・1 min read

I recently came across Github Actions. It's a powerful tool. So, i thought of giving it a try. So, I used it to automate the build of react native android apk.
I created a github repository for this project.

Check it our here

πŸš€ Github Action for React Native Build

Add the build.yml as follows

.github/workflows/build.yml

in the project.

name: build
on:
  push:
    branches:
      - master
jobs:
  install-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install npm dependencies
        run: |
          npm install
  build-android:
    needs: install-and-test
    runs-on: ubuntu-latest
    steps: 
      - uses: actions/checkout@v2
      - name: Install npm dependencies
        run: |
          npm install
      - name: Build Android Release
        run: |
          cd android && ./gradlew assembleRelease
      - name: Upload Artifact
        uses: actions/upload-artifact@v1
        with:
          name: app-release.apk
          path: android/app/build/outputs/apk/release/

Build will be triggered as soon as the commit is pushed to the master branch.

After that, builded apk can be found under the artifact section

Troubleshoot

Gradlew commands not working

You can try to execute the following command before run gradle commands.

chmod +x ./gradlew

Gradlew Command Not working in Github Actions React Native

Posted on Aug 22 '19 by:

realabbas profile

Ali Abbas

@realabbas

MERN Stack Developer, with the passion to develop apps that can make this world better. "Whenever I get bored, I call API's"

Discussion

markdown guide