Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/build-apks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow automates the build process and artifact uploading for an Android app.

name: Android CI/CD

on:
# This allows you to manually trigger the workflow from the GitHub UI.
workflow_dispatch:

push:
branches:
- main

release:
types:
- created
- published

jobs:
build_and_upload_apk:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Grant execute permission to gradlew
run: chmod +x gradlew

# Step 4: Build the Android app based on the trigger.
# This step uses an 'if-elif' conditional to determine the correct build variant.
- name: Build APK based on trigger
id: build_apk
run: |
BUILD_VARIANT=""
APK_PATH=""

# Determine the build variant based on the triggering event.
if [[ "${{ github.event_name }}" == "release" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "Triggered by release or manual dispatch. Building release variant."
BUILD_VARIANT="release"
./gradlew assembleRelease
APK_PATH=app/build/outputs/apk/release/app-universal-release-unsigned.apk
else
echo "Triggered by push to 'main' branch. Building staging variant."
BUILD_VARIANT="staging"
./gradlew assembleStaging
APK_PATH=app/build/outputs/apk/staging/app-universal-staging-unsigned.apk
fi

# Set the output variables for the next steps.
echo "build_variant=${BUILD_VARIANT}" >> $GITHUB_OUTPUT
echo "apk_path=${APK_PATH}" >> $GITHUB_OUTPUT
echo "Found APK at: ${{ steps.build_apk.outputs.apk_path }}"

- name: Upload APK as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build_apk.outputs.build_variant }}-apk
path: ${{ steps.build_apk.outputs.apk_path }}
if-no-files-found: error
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Passcodes

[![Android CI/CD](https://github.com/JeelDobariya38/Passcodes/actions/workflows/build-apks.yml/badge.svg)](https://github.com/JeelDobariya38/Passcodes/actions/workflows/build-apks.yml)

A android app that take down the headace of remember passwords. It is open source solutions that help you in keep your passwords safe and secure in your own local storage without ever need to push them to cloud.

> [!WARNING]
Expand Down