Skip to content

Commit

Permalink
chore: add android build
Browse files Browse the repository at this point in the history
  • Loading branch information
xinshangshangxin committed May 19, 2022
1 parent 4385b0e commit 4e61fc5
Show file tree
Hide file tree
Showing 9 changed files with 4,374 additions and 91 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Android build

on:
push:
branches:
- develop

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-
- name: build
working-directory: ./
run: |
cd frontend
npm ci
npm run build:android
cd ../
cd android
npm ci
npm run build:front
npm run build:action
- name: set asset_path env
run: |
ls -lah android/dist
asset_path=$(ls ./android\/dist/*.apk)
asset_name=${asset_path#*android\/dist/}
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 }}
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
build:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest

steps:
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/gh-pages.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/remove-old-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Remove old artifacts

on:
schedule:
- cron: "1 1 1 * *"

jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
age: "1 month"
skip-tags: false
skip-recent: 3
9 changes: 8 additions & 1 deletion android/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# High Music

使用 [androidjs](https://github.com/android-js/androidjs) 构建的 安卓应用

## Build

```bash
$ androidjs b
npm run build
```

## 已知问题

- 无法后台播放 [issue](https://github.com/android-js/androidjs/issues/207)
6 changes: 6 additions & 0 deletions android/devtools/action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const noop = () => {};

process.stdout.clearLine = noop;
process.stdout.cursorTo = noop;

require("androidjs-builder/bin.js");
2 changes: 1 addition & 1 deletion android/devtools/build-front.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const appDir = `
const dist = resolve(__dirname, "../views/");

fs.emptyDirSync(dist);
fs.copySync(resolve(__dirname, "../../../frontend/dist/"), dist);
fs.copySync(resolve(__dirname, "../../frontend/dist/"), dist);

const indexHtmlPath = resolve(dist, "index.html");

Expand Down
Loading

0 comments on commit 4e61fc5

Please sign in to comment.