Skip to content

feat: add sixyin

feat: add sixyin #76

Workflow file for this run

name: Android build
on: push
jobs:
build:
# if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-java@v3
with:
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "11.0"
- name: Decode Keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
run: |
KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore.jks
echo ${KEYSTORE} | base64 -di > "${KEYSTORE_FILE_PATH}"
echo "::set-env name=KEYSTORE_FILE_PATH::${KEYSTORE_FILE_PATH}"
- name: build
env:
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
working-directory: ./
run: |
# 先构建前端项目
cd frontend
npm ci
npm run build:android
# mkdir dist
# echo "" > dist/index.html
# 复制前端项目
cd ../
cd android
npm ci
npm run build:static
# action 构建出现问题, 临时修复
cp node_modules/capacitor-nodejs/android/src/main/cpp/Bridge.h node_modules/capacitor-nodejs/android/src/main/cpp/bridge.h || true
# 安装 nodejs 依赖
cd www
npm ci
# cap sync
cd ..
npm run sync
# apk build
cd android
gradle assembleDebug
- name: set asset_path env
run: |
ls -lah android/android/app/build/outputs/apk/debug
asset_path=$(ls ./android/android/app/build/outputs/apk/debug/*.apk)
asset_name=${asset_path#*debug/}
echo "::set-env name=ASSET_PATH::${asset_path}"
echo "::set-env name=ASSET_NAME::${asset_name}"
- name: Upload apk
uses: actions/upload-artifact@v1
with:
name: ${{ env.ASSET_NAME }}
path: ${{ env.ASSET_PATH }}