DEV Community

Harsh
Harsh

Posted on

Build Ionic framework App Source and Artifact Android Apk Action

My Workflow

his GitHub Action "Get Android Apk" is designed to automate the developers work to:

  • Configure the Java,Node.js,Ionic cli
  • Build from latest Ionic Source and make android source
  • Then Build the Android app from latest Source
  • Upload The build to the the Artifact for Testing on every changes done in master branch

Submission Category:

- Maintainer Must-Haves, DIY Deployments

Yaml File or Link to Code

name: Get Android APK

on: [push, pull_request]

jobs:
  build:
    name: Build APK
    runs-on: ubuntu-latest
    steps:
      - name: checkout source
        uses: actions/checkout@v2

      - name: setup java sdk
        uses: actions/setup-java@v1
        with:
          java-version: '9.0.4'

      - name: setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 13.x

      - name: Install Cordova
        run: npm install -g cordova

      - name: Install Ionic cli
        run: npm install -g @ionic/cli

      - name: Install app dependencies
        run: npm install

      - name: build the app
        run: npm run build

      - name: remove existing folder if there 
        run: rm -rf {path of your android folder dir.} # eg. /home/runner/work/Bookie/Bookie/android

      - name: Add to android
        run: npx cap add android

      - name: sync with source
        run: npx cap sync

      - name: Generate the Android App Apk
        working-directory: {working android directory} # eg. /home/runner/work/Bookie/Bookie/android 
        run: bash ./gradlew assembleDebug --stacktrace

      - name: Upload dev APK
        uses: actions/upload-artifact@v1
        with:
          name: app-dev
          path: android/app/build/outputs/apk/debug/app-debug.apk
Enter fullscreen mode Exit fullscreen mode

GitHub logo hpnightowl / Bookie

Pocket Alternative for Personal Use

Get Android APK

Flutter action

Ionic Android APK Generator Action


  • This repository is dedicated to a GitHub Action for generating a new apk and pushing it to the repository, whenever changes are made in master branch.

Usage

Example Workflow file

An example workflow to set up your Ionic Android apk generator action quickly.

name: Get Android APK
on: [push, pull_request]

jobs:
  build:
    name: Build APK
    runs-on: ubuntu-latest
    steps:
      - name: checkout source
        uses: actions/checkout@v2

      - name: setup java sdk
        uses: actions/setup-java@v1
        with:
          java-version: '9.0.4'
          
      - name: setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 13.x

      - name: Install Cordova
        run: npm install -g cordova

      - name: Install Ionic cli
        run: npm install -g @ionic/cli

      - name: Install app dependencies
        run: npm install

      - name: build the app
        run: npm run
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

GitHub logo actions / checkout

Action for checking out a repo

GitHub Actions status

Checkout V2

This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.

Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set fetch-depth: 0 to fetch all history for all branches and tags. Refer here to learn which commit $GITHUB_SHA points to for different events.

The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set persist-credentials: false to opt-out.

When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files.

What's new

  • Improved performance
    • Fetches only a single commit by default
  • Script authenticated git commands
    • Auth token persisted in the local git config
  • Supports SSH
  • Creates a local branch
    • No longer detached HEAD when checking out a branch
  • Improved layout
    • The input path is…





GitHub logo actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java

setup-java

GitHub Actions status

This action provides the following functionality for GitHub Actions runners:

  • Downloading and setting up a requested version of Java. See Usage for a list of supported distributions
  • Extracting and caching custom version of Java from a local file
  • Configuring runner for publishing using Apache Maven
  • Configuring runner for publishing using Gradle
  • Configuring runner for using GPG private key
  • Registering problem matchers for error output
  • Caching dependencies managed by Apache Maven
  • Caching dependencies managed by Gradle

V2 vs V1

  • V2 supports custom distributions and provides support for Zulu OpenJDK, Eclipse Temurin and Adopt OpenJDK out of the box. V1 supports only Zulu OpenJDK
  • V2 requires you to specify distribution along with the version. V1 defaults to Zulu OpenJDK, only version input is required. Follow the migration guide to switch from V1 to V2

Usage

Inputs java-version and distribution are mandatory. See Supported distributions section for a list of available options.

GitHub logo actions / setup-node

Set up your GitHub Actions workflow with a specific version of node.js

setup-node

build-test status versions status proxy status

This action provides the following functionality for GitHub Actions users:

  • Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
  • Optionally caching npm/yarn/pnpm dependencies
  • Registering problem matchers for error output
  • Configuring authentication for GPR or npm

Usage

See action.yml

Basic:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
  with:
    node-version: '14'
- run: npm install
- run: npm test
Enter fullscreen mode Exit fullscreen mode

The node-version input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.

The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from node-versions releases and on miss or…

Made with ❤️ by hpnightowl

Top comments (0)