Android Build Action 开源项目教程
android-build-actionBuild Android project, export .apk, optional upload to BrowserStack App Live.项目地址:https://gitcode.com/gh_mirrors/an/android-build-action
1、项目的目录结构及介绍
sparkfabrik/android-build-action/
├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── README.md
├── action.yml
├── build.sh
└── fastlane/
.github/workflows/main.yml: GitHub Actions 的工作流配置文件。.gitignore: 用于指定 Git 忽略的文件和目录。CHANGELOG.md: 记录项目变更的日志文件。Gemfile: 用于管理项目的依赖。LICENSE: 项目的许可证文件。README.md: 项目的说明文档。action.yml: GitHub Actions 的定义文件。build.sh: 用于构建 Android 项目的脚本。fastlane/: 包含 fastlane 配置文件的目录。
2、项目的启动文件介绍
项目的启动文件是 build.sh。这个脚本用于构建 Android 项目并生成 APK 文件。以下是 build.sh 的基本内容:
#!/bin/bash
 
# 设置 Gradle 参数
export GRADLE_OPTS="-Xmx2048m -Dorg.gradle.daemon=false"
 
# 构建项目
./gradlew build
 
# 输出 APK 文件路径
echo "APK 文件路径: app/build/outputs/apk/release/app-release.apk"
3、项目的配置文件介绍
action.yml
action.yml 是 GitHub Actions 的定义文件,用于定义该 Action 的输入、输出和运行步骤。以下是 action.yml 的基本内容:
name: 'Build Android App'
description: 'Build Android project and export APK file as GitHub artifact'
inputs:
  android-project-path:
    description: 'Path to the Android project'
    required: true
  build-type:
    description: 'Build type (debug or release)'
    required: true
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.android-project-path }}
    - ${{ inputs.build-type }}
.github/workflows/main.yml
main.yml 是 GitHub Actions 的工作流配置文件,用于定义触发条件和执行步骤。以下是 main.yml 的基本内容:
name: Build Android App
 
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Build Android App
        uses: sparkfabrik/android-build-action@v1.5.0
        with:
          android-project-path: '.'
          build-type: 'release'
以上是 Android Build Action 开源项目的目录结构、启动文件和配置文件的介绍。希望这份教程能帮助你更好地理解和使用该项目。
android-build-actionBuild Android project, export .apk, optional upload to BrowserStack App Live.项目地址:https://gitcode.com/gh_mirrors/an/android-build-action
 
                             
                         
                             
               
                             
                         赣公网安备36020002000448号
 赣公网安备36020002000448号