Initial commit: Android题库APP - Jetpack Compose + Retrofit
This commit is contained in:
91
.gitea/workflows/build-release.yml
Normal file
91
.gitea/workflows/build-release.yml
Normal file
@@ -0,0 +1,91 @@
|
||||
name: Build and Release APK
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build Debug APK
|
||||
run: ./gradlew assembleDebug
|
||||
|
||||
- name: Build Release APK
|
||||
run: ./gradlew assembleRelease
|
||||
continue-on-error: true
|
||||
|
||||
- name: List APK files
|
||||
run: find . -name "*.apk" -type f
|
||||
|
||||
- name: Copy APK to output
|
||||
run: |
|
||||
mkdir -p output
|
||||
find app/build/outputs -name "*.apk" -exec cp {} output/ \;
|
||||
ls -la output/
|
||||
|
||||
- name: Upload APK artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: apk-files
|
||||
path: output/*.apk
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download APK artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: apk-files
|
||||
path: output/
|
||||
|
||||
- name: List downloaded files
|
||||
run: ls -la output/
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
body: |
|
||||
## 题库APP ${{ github.ref_name }}
|
||||
|
||||
### 更新内容
|
||||
- 自动构建发布
|
||||
|
||||
### 下载
|
||||
请从下方Assets中下载APK文件安装使用
|
||||
files: output/*.apk
|
||||
draft: false
|
||||
prerelease: false
|
||||
Reference in New Issue
Block a user