Convert Windows app to Electron and add Android Capacitor app with CI builds
This commit is contained in:
101
.github/workflows/build-android-app.yml
vendored
Normal file
101
.github/workflows/build-android-app.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: Build Android App (Capacitor)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- android-app/**
|
||||
- chat/public/**
|
||||
- .github/workflows/build-android-app.yml
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
name: Build Android APK
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: android-app/package-lock.json
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: android-app
|
||||
|
||||
- name: Prepare UI
|
||||
run: npm run prepare-ui
|
||||
working-directory: android-app
|
||||
|
||||
- name: Initialize Capacitor
|
||||
run: npx cap init "ShopifyAI" com.shopifyai.app --web-dir www
|
||||
working-directory: android-app
|
||||
|
||||
- name: Add Android platform
|
||||
run: npx cap add android
|
||||
working-directory: android-app
|
||||
|
||||
- name: Sync Capacitor
|
||||
run: npx cap sync android
|
||||
working-directory: android-app
|
||||
|
||||
- name: Build APK
|
||||
run: |
|
||||
cd android
|
||||
chmod +x gradlew
|
||||
./gradlew assembleDebug
|
||||
working-directory: android-app
|
||||
env:
|
||||
BACKEND_BASE_URL: ${{ secrets.BACKEND_BASE_URL }}
|
||||
|
||||
- name: Upload APK artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: shopify-ai-android-apk
|
||||
path: android-app/android/app/build/outputs/apk/debug/*.apk
|
||||
retention-days: 7
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: android-app-${{ github.sha }}
|
||||
release_name: ShopifyAI Android App ${{ github.sha }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Get APK filename
|
||||
id: apk
|
||||
run: echo "filename=$(ls android-app/android/app/build/outputs/apk/debug/*.apk)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: android-app/android/app/build/outputs/apk/debug/app-debug.apk
|
||||
asset_name: ShopifyAI-0.1.0.apk
|
||||
asset_content_type: application/vnd.android.package-archive
|
||||
69
.github/workflows/build-electron-app.yml
vendored
Normal file
69
.github/workflows/build-electron-app.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: Build Electron Windows App
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- windows-app/**
|
||||
- chat/public/**
|
||||
- .github/workflows/build-electron-app.yml
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
name: Build Electron App (Windows)
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: windows-app/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: windows-app
|
||||
|
||||
- name: Build Electron app
|
||||
run: npm run build:win
|
||||
working-directory: windows-app
|
||||
env:
|
||||
BACKEND_BASE_URL: ${{ secrets.BACKEND_BASE_URL }}
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: shopify-ai-electron-windows
|
||||
path: windows-app/dist/*.exe
|
||||
retention-days: 7
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: electron-app-${{ github.sha }}
|
||||
release_name: ShopifyAI Electron App ${{ github.sha }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: windows-app/dist/ShopifyAI Desktop Setup 0.1.0.exe
|
||||
asset_name: ShopifyAI-Desktop-Setup-0.1.0.exe
|
||||
asset_content_type: application/octet-stream
|
||||
Reference in New Issue
Block a user