Add android_ci.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 通过预定义的包管理器之一管理的依赖项的快速设置缓存 | |
# 它可以是maven、gradle或sbt之一 | |
cache: 'gradle' | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Retrieve version | |
run: | | |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 7) >> $GITHUB_ENV | |
- name: Build with Gradle | |
run: | | |
chmod +x ./scripts/*.sh | |
./scripts/build.sh ${{ env.VERSION }} | |
- name: Upload APK artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
# 指定要上传的目录在上传到当前Actions运行实例的Artifacts当中时要使用的名字 | |
name: lavsource-bilibili-apk-${{ env.VERSION }} | |
# 要上传的目录路径(以项目根目录为相对路径起始点) | |
path: android/build/outputs/apk/release |