Skip to content

Commit 5683dcc

Browse files
committed
update readme
1 parent 985a91f commit 5683dcc

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,56 @@
1-
# AndroidAutoBuildAPK
1+
# Android Auto-Build APK
2+
3+
This is an example of how to build an APK using GitHub Actions. Here, we created a simple Android application that displays a TODO. We then created a workflow that builds the APK and uploads it as a new release.
4+
5+
## How to use
6+
7+
```yml
8+
on:
9+
push:
10+
branches:
11+
- main
12+
name: Build project after push
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: set up JDK 11
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '11'
22+
distribution: 'temurin'
23+
cache: gradle
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
- name: Build with Gradle
28+
run: ./gradlew build
29+
- name: Build debug APK
30+
run: bash ./gradlew assembleDebug --stacktrace
31+
32+
- name: Check files
33+
run: ls -al app/build/outputs/apk/debug
34+
35+
- name: Create Release
36+
id: create_release
37+
uses: actions/create-release@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
40+
with:
41+
tag_name: ${{ github.run_number }}
42+
release_name: ${{ github.event.repository.name }} v${{ github.run_number }}
43+
44+
- name: Upload Release APK
45+
id: upload_release_asset
46+
uses: actions/[email protected]
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
asset_path: app/build/outputs/apk/debug/app-debug.apk
52+
asset_name: ${{ github.event.repository.name }}.apk
53+
asset_content_type: application/vnd.android.package-archive
54+
```
55+
56+
Check out the [workflow](.github/workflows/build.yml) for more details.

0 commit comments

Comments
 (0)