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

Build and Test

Checkout V4

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

Please refer to the release page for the latest release notes.

Usage

- uses: actions/checkout@v4
  with
    # Repository name with owner. For example, actions/checkout
    # Default: ${{ github.repository }}
    repository: ''

    # The branch, tag or SHA to
Enter fullscreen mode Exit fullscreen mode

GitHub logo actions / setup-java

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

Setup Java

Basic validation Validate Java e2e Validate cache

The setup-java 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.
  • Caching dependencies managed by sbt.
  • Maven Toolchains declaration for specified JDK versions.

This action allows you to work with Java and Scala projects.

V2 vs V1

  • V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
  • V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required…

GitHub logo actions / setup-node

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

setup-node

basic-validation versions e2e-cache proxy

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

- uses: actions/setup-node@v4
  with
    # Version Spec of the version to use in SemVer notation.
    # It also emits such aliases as lts, latest, nightly and canary builds
    # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node
    node-version: ''

    # File containing the version Spec of the version to use.  Examples: package.json, .nvmrc, .node-version, .tool-versions.
    # If node-version and node-version-file are both provided the action will use version from node-version. 
    node-version-file: ''

    # Set this option if you want the action to check for the latest available version 
    # that satisfies the version spec.
    # It will only
Enter fullscreen mode Exit fullscreen mode

Made with ❤️ by hpnightowl

Top comments (0)