Skip to content

Build APK

Build APK #28

Workflow file for this run

name: Build APK
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
on:
workflow_dispatch:
inputs:
url:
description: 'Website URL'
required: true
default: 'https://deckk.it'
type: string
app_name:
description: 'App Name'
required: true
default: 'deckk.it'
type: string
package_name:
description: 'Package Name'
required: true
default: 'com.deckk.it'
type: string
favicon_url:
description: 'Favicon URL (optional)'
required: false
type: string
build_type:
description: 'Build Type'
required: true
default: 'release'
type: choice
options:
- release
- debug
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up keystore
run: |
if [ "${{ github.event.inputs.build_type }}" = "release" ]; then
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks
else
touch keystore.jks
fi
- name: Build Docker image (release)
if: ${{ github.event.inputs.build_type == 'release' }}
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: webview-builder
build-args: |
WEBSITE_URL=${{ github.event.inputs.url }}
APP_NAME=${{ github.event.inputs.app_name }}
PACKAGE_NAME=${{ github.event.inputs.package_name }}
FAVICON_URL=${{ github.event.inputs.favicon_url }}
BUILD_TYPE=${{ github.event.inputs.build_type }}
env:
WEBSITE_URL: ${{ github.event.inputs.url }}
APP_NAME: ${{ github.event.inputs.app_name }}
PACKAGE_NAME: ${{ github.event.inputs.package_name }}
FAVICON_URL: ${{ github.event.inputs.favicon_url }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Build Docker image (debug)
if: ${{ github.event.inputs.build_type == 'debug' }}
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: webview-builder
build-args: |
WEBSITE_URL=${{ github.event.inputs.url }}
APP_NAME=${{ github.event.inputs.app_name }}
PACKAGE_NAME=${{ github.event.inputs.package_name }}
FAVICON_URL=${{ github.event.inputs.favicon_url }}
BUILD_TYPE=${{ github.event.inputs.build_type }}
env:
WEBSITE_URL: ${{ github.event.inputs.url }}
APP_NAME: ${{ github.event.inputs.app_name }}
PACKAGE_NAME: ${{ github.event.inputs.package_name }}
FAVICON_URL: ${{ github.event.inputs.favicon_url }}
- name: Extract APK from container
run: |
CONTAINER_ID=$(docker run -d webview-builder)
echo "Container started: $CONTAINER_ID"
sleep 5
APK_PATH=$(docker exec "$CONTAINER_ID" find /project -name "*.apk" | head -1)
echo "Found APK at: $APK_PATH"
docker cp "$CONTAINER_ID:$APK_PATH" ./${{ github.event.inputs.app_name }}.apk
docker rm -f "$CONTAINER_ID"
- name: Verify APK exists
run: |
if [ ! -f "${{ github.event.inputs.app_name }}.apk" ]; then
echo "Error: APK file not found"
exit 1
fi
ls -lh ${{ github.event.inputs.app_name }}.apk
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.event.inputs.app_name }} ${{ github.event.inputs.build_type }} APK
tag_name: ${{ github.event.inputs.app_name }}-${{ github.event.inputs.build_type }}-${{ github.run_id }}
draft: false
prerelease: false
files: ${{ github.event.inputs.app_name }}.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup secrets
if: always()
run: |
rm -f keystore.jks