mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 16:41:59 +00:00
CI: introduce android workflow
This commit is contained in:
parent
7d6ac89321
commit
470a09f158
7 changed files with 128 additions and 14 deletions
102
.github/workflows/android.yml
vendored
Normal file
102
.github/workflows/android.yml
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
name: Android Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Electron Build and Release"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./capacitor
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Setup PNPM
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9.4.0
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '19'
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Install node-pre-gyp
|
||||||
|
run: pnpm install -g node-pre-gyp
|
||||||
|
|
||||||
|
- name: Remove Cached Build
|
||||||
|
run: rm -rf ./build && mkdir ./build
|
||||||
|
|
||||||
|
- name: Build Native + Web
|
||||||
|
run: pnpm run build:app
|
||||||
|
|
||||||
|
- name: Sync
|
||||||
|
run: pnpm exec cap sync android
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gradle-
|
||||||
|
|
||||||
|
- name: Build App
|
||||||
|
run: cd android && chmod +x ./gradlew && ./gradlew assembleRelease
|
||||||
|
|
||||||
|
- name: Stop Gradle daemon
|
||||||
|
run: cd android && ./gradlew --stop
|
||||||
|
|
||||||
|
- name: Setup build tool version variable
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
|
||||||
|
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
|
||||||
|
echo Last build tool version is: $BUILD_TOOL_VERSION
|
||||||
|
|
||||||
|
- uses: filippoLeporati93/android-release-signer@v1
|
||||||
|
name: Sign app APK
|
||||||
|
id: sign_app
|
||||||
|
with:
|
||||||
|
releaseDirectory: capacitor/android/app/build/outputs/apk/release
|
||||||
|
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
||||||
|
alias: ${{ secrets.ALIAS }}
|
||||||
|
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||||
|
env:
|
||||||
|
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
|
||||||
|
|
||||||
|
- uses: jungwinter/split@v2
|
||||||
|
id: signed_files
|
||||||
|
with:
|
||||||
|
msg: ${{ steps.sign_app.outputs.signedReleaseFiles }}
|
||||||
|
separator: ':'
|
||||||
|
|
||||||
|
- name: Upload APK to release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._0 }}
|
||||||
|
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._1 }}
|
||||||
|
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._2 }}
|
||||||
|
gh release upload --clobber $(gh release list --limit 1 --json tagName --jq '.[0].tagName') ../${{ steps.signed_files.outputs._3 }}
|
||||||
24
.github/workflows/main.yml
vendored
24
.github/workflows/main.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build/release
|
name: Electron Build and Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -15,28 +15,32 @@ jobs:
|
||||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Setuptools for Python
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: pip3 install setuptools --break-system-packages
|
|
||||||
|
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Setup PNPM
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8.6.3
|
version: 9.4.0
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '20'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
|
- name: Install Setuptools for Python (macOS only)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
run: pip3 install setuptools --break-system-packages
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: cd electron && pnpm install --frozen-lockfile
|
run: |
|
||||||
|
cd electron
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build and Publish
|
- name: Build and Publish
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: cd electron && npm run publish
|
run: |
|
||||||
|
cd electron
|
||||||
|
npm run publish
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/ThaUnknown/miru">
|
<a href="https://github.com/ThaUnknown/miru">
|
||||||
<img src="./common/public/logo_filled.png" width="200">
|
<img src="./common/public/logo_filled.png" width="250">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center"><b>Migu</b></h1>
|
<h1 align="center"><b>Migu</b></h1>
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,14 @@ android {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
enable true
|
||||||
|
reset()
|
||||||
|
include "armeabi-v7a", "arm64-v8a", "x86_64"
|
||||||
|
universalApk true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
||||||
0
capacitor/android/app/src/main/assets/.gitkeep
Normal file
0
capacitor/android/app/src/main/assets/.gitkeep
Normal file
|
|
@ -21,6 +21,6 @@ const config = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode === 'development') config.server.url = 'http://localhost:5001/index.html'
|
// if (mode === 'development') config.server.url = 'http://localhost:5001/index.html'
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:native": "cd public/nodejs/ && pnpm install && docker build -t android-build:latest . && docker run -v ${PWD}:/app/ -it android-build:latest /bin/bash /app/setup-deps.sh",
|
"build:native": "cd public/nodejs/ && pnpm install && docker build -t android-build:latest . && docker run -v ${PWD}:/app/ android-build:latest /bin/bash /app/setup-deps.sh",
|
||||||
"build:native-win": "cd public\\nodejs && for %I in (.) do docker run -v %~fI:/app/ -it android-build:latest /bin/bash /app/setup-deps-win.sh",
|
"build:native-win": "cd public\\nodejs && for %I in (.) do docker run -v %~fI:/app/ -it android-build:latest /bin/bash /app/setup-deps-win.sh",
|
||||||
"build:app": "cross-env NODE_ENV=production run-s build:web build:native build:assets",
|
"build:app": "cross-env NODE_ENV=production run-s build:web build:native",
|
||||||
"build:web": "webpack build",
|
"build:web": "webpack build",
|
||||||
"build:assets": "capacitor-assets generate --iconBackgroundColor #20a2ff --iconBackgroundColorDark #20a2ff --splashBackgroundColor #20a2ff --splashBackgroundColorDark #20a2ff --android",
|
"build:assets": "capacitor-assets generate --iconBackgroundColor #20a2ff --iconBackgroundColorDark #20a2ff --splashBackgroundColor #20a2ff --splashBackgroundColorDark #20a2ff --android",
|
||||||
"dev:adb-port": "adb reverse tcp:5001 tcp:5001",
|
"dev:adb-port": "adb reverse tcp:5001 tcp:5001",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue